题目
Description
Fans是个ACM程序设计迷。有时侯,他表现出很强烈的逆反心理,你往东,他往西,你往南,他偏往北。这一次,不知道又是谁惹着他了,好端端的一个个01串,到了他的手里,都变成10串了。请你编个程序来模仿他的行为,将01串(长度≤200),全变成10串吧。
Input
0110100100100 1000000010000000000
Output
1001011011011 0111111101111111111
Sample Input
0110100100100
1000000010000000000
Sample Output
1001011011011
0111111101111111111
代码块
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cn = new Scanner(System.in);
while(cn.hasNext()){
String str = cn.nextLine();
for(int i =0;i<str.length();i++){
if(str.charAt(i)=='0'){//进行判断输出
System.out.print(1);
}else if(str.charAt(i)=='1'){
System.out.print(0);
}else System.out.print(str.charAt(i));
}
System.out.println();
}
}
}