原题链接:
逆反的01串
解题思路:
注意事项:
参考代码:
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
while(in.hasNext()) {
StringBuffer str= new StringBuffer("");
str.append(in.next());
for(int i=0;i<str.length();i++) {
if(str.charAt(i)=='1') {
str.setCharAt(i, '0');
continue;
}
if(str.charAt(i)=='0') {
str.setCharAt(i, '1');
}
}
System.out.println(str.toString());
}
}