参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); String as=scanner.next(); String bs=scanner.next(); int temp=(as.length()>bs.length())?as.length():bs.length(); int i=0; boolean a1=false; while (i!=temp) { if (as.length()!=bs.length()) { System.out.println(1); return; } if (as.equals(bs)) { System.out.println(2); return; } if (as.charAt(i)==bs.charAt(i)||as.charAt(i)+32==bs.charAt(i)||as.charAt(i)==bs.charAt(i)+32){ a1=true; }else { a1=false; break; } i++; } if (a1==true) { System.out.println(3); }else { System.out.println(4); } } }
0.0分
1 人评分