1
import java.util.Scanner;
public class FanYingBi {
public static void main(String[] args) {
int count = 0;
Scanner sc = new Scanner(System.in);
StringBuffer str1 = new StringBuffer(sc.nextLine());
StringBuffer str2 = new StringBuffer(sc.nextLine());
for (int i = 0; i < str1.length() - 1; i++) {
if (str1.charAt(i) != str2.charAt(i)) {
str2.setCharAt(i, str1.charAt(i));
if (str2.charAt(i + 1) == ‘*‘) {
str2.setCharAt((i + 1), ‘o‘);
} else {
str2.setCharAt((i + 1), ‘*‘);
}
++count;
}
}
System.out.println(count);
}
}
原文:http://blog.csdn.net/xurunhong/article/details/23607165