参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s1 = scanner.nextLine(); String s2 = scanner.nextLine(); scanner.close(); char[] c1 = s1.toCharArray(); char[] c2 = s2.toCharArray(); contrast(c1, c2); } public static void contrast(char[] c1, char[] c2) { if (c1.length != c2.length) { System.out.println(1); } else { boolean b = true; for (int i = 0; i < c1.length; i++) { if (c1[i] != c2[i]) { b = false; break; } } if (b) { System.out.println(2); } else { boolean c = true; for (int i = 0; i < c1.length; i++) { if (c1[i] != c2[i] && c1[i] - 32 != c2[i] && c2[i] - 32 != c1[i]) { c = false; break; } } if (c) { System.out.println(3); } else { System.out.println(4); } } } } }
0.0分
0 人评分
矩阵乘法 (C++代码)浏览:1662 |
A+B for Input-Output Practice (III) (C语言代码)浏览:592 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:366 |
【明明的随机数】 (C语言代码)浏览:845 |
【矩阵】 (C++代码)浏览:999 |
求圆的面积 (C语言代码)浏览:1756 |
一元一次方程 (C语言代码)浏览:4247 |
前10名 (C语言代码)浏览:773 |
单词个数统计 (C语言代码)浏览:1046 |
链表数据求和操作 (C语言代码)浏览:1035 |