刘雨乐


私信TA

用户名:dotcpp0606441

访问量:966

签 名:

等  级
排  名 3163
经  验 1931
参赛次数 1
文章发表 9
年  龄 0
在职情况 学生
学  校 鄂州职业大学
专  业

  自我简介:

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str2 = sc.next();
		String str3 = sc.next();
		int count = 0;
		StringBuilder str = new StringBuilder(str2);
		StringBuilder str1 = new StringBuilder(str3);
		for (int i = 0; i < str.length(); i++) {
			if (str1.charAt(i)!=str.charAt(i)) {
				if (str1.charAt(i)=='o') {
					str1.setCharAt(i, '*');
				}else {
					str1.setCharAt(i, 'o');
				}
				if (str1.charAt(i+1)=='o') {
					str1.setCharAt(i+1, '*');
				}else {
					str1.setCharAt(i+1, 'o');
				}
				count++;
			}
		}
		System.out.println(count);

	}

}
 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区