想用java实现一下 运行RE 求解
查看原帖
想用java实现一下 运行RE 求解
852182
xangtian_six楼主2023/3/7 00:47
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		String x,y;
		int num = 0;
		char a[] = new char[1000];
		char b[] = new char[1000];
		try (Scanner sc = new Scanner(System.in)) {
			x = sc.nextLine();
			y = sc.nextLine();
		}
		for(int i =0; i<x.length();i++) {
			a[i] = x.charAt(i);
			b[i] = y.charAt(i);
		}
		for(int i =0; i<x.length();i++) {
			if(a[i] == b[i]) {
				continue;
			}else {
				a[i+1] =(a[i+1]=='*' ?'o':'*') ;
				num++;
			}
		}
		System.out.println(num);
}
}
2023/3/7 00:47
加载中...