#11880: 求第2個測資

#### u10550087 (學渣協會)

School : 臺北市立麗山高級中學
ID : 62268
IP address : [140.113.141.83]
Last Login ：
2021-05-13 19:34:33
a870. 10. List Maker -- | From: [111.251.143.63] | Post Date : 2017-04-09 13:50

import java.util.*; public class JAVA{ public static void main(String args[]){ Scanner scanner = new Scanner(System.in); String a,w,ans="",b; while(scanner.hasNext()){ a=scanner.next(); if(a.equals("SHOW"))break; w=scanner.next(); if(a.equals("ADD")){ ans = ans+w+" "; } else if(a.equals("INSERT")){ b=scanner.next(); ans=ans.replaceFirst(b,w+" "+b); } else if(a.equals("REMOVE")){ ans=ans.replaceFirst(w+" ",""); } } System.out.println(ans); } }

您的答案為: ASK NOT DO FOR WHAT YOUR COUNTRY CAN YOU



#11881: Re:求第2個測資

#### letitgo (讓它過)

School : No School
ID : 65414
IP address : [49.219.166.249]
Last Login ：
2018-08-18 17:01:06
a870. 10. List Maker -- | From: [101.13.161.13] | Post Date : 2017-04-09 16:26

INSERT b 少空白，可能有abc誤換abcde之abc。

#11895: Re:求第2個測資

#### SuperDavid (D.J)

School : 臺北市立麗山高級中學
ID : 58490
IP address : [111.251.23.38]
Last Login ：
2021-05-13 19:34:36
a870. 10. List Maker -- | From: [163.21.208.101] | Post Date : 2017-04-14 14:15

import java.util.*; public class JAVA{ public static void main(String args[]){ Scanner scanner = new Scanner(System.in); String a,w,ans="",b; while(scanner.hasNext()){ a=scanner.next(); if(a.equals("SHOW"))break; w=scanner.next(); if(a.equals("ADD")){ ans = ans+w+" "; } else if(a.equals("INSERT")){ b=scanner.next(); ans=ans.replaceFirst(b,w+" "+b); } else if(a.equals("REMOVE")){ ans=ans.replaceFirst(w+" ",""); } } System.out.println(ans); } }

您的答案為: ASK NOT DO FOR WHAT YOUR COUNTRY CAN YOU



import java.util.*;
class Ideone{
public static void main(String args[]){
Scanner scanner = new Scanner(System.in);
String a,w,ans="",b;
while(scanner.hasNext()){
a=scanner.next();
if(a.equals("SHOW"))break;
w=scanner.next();
if(a.equals("ADD")){
ans = ans+w+" ";
}
else if(a.equals("INSERT")){
b=scanner.next();
ans=ans.replaceFirst(b+" ",w+" "+b+" ");
}
else if(a.equals("REMOVE")){
ans=ans.replaceFirst(w+" ","");
}
}
System.out.println(ans);
}
}


ZeroJudge Forum