#43529: java答案


w122322222@gmail.com (m n j h p)

學校 : 不指定學校
編號 : 289597
來源 : [140.136.20.201]
最後登入時間 :
2024-10-27 20:06:50
c007. 00272 - TeX Quotes -- UVa272 | From: [140.136.33.249] | 發表日期 : 2024-10-21 19:11

import java.util.*;//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
ArrayList<String>all=new ArrayList<>();
while(sc.hasNext()){
String in=sc.nextLine();
all.add(in);
}
int k=0;
for(int i=0;i<all.size();i++){

for(int y=0;y<all.get(i).length();y++){
if((k % 2)==0 &&all.get(i).charAt(y)=='"'){
System.out.print("``");
k+=1;
continue;
}
else if((k % 2)!=0 &&all.get(i).charAt(y)=='"'){
System.out.print("''");
k+=1;
continue;
}
System.out.print(all.get(i).charAt(y));
}
System.out.print("\n");
}
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.

}
}
 
ZeroJudge Forum