题意一定要看清楚 是 i I O 跟0 (不要看成 1 跟 I)
题意一定要看清楚 是 i I O 跟0 (不要看成 1 跟 I)
题意一定要看清楚 是 i I O 跟0 (不要看成 1 跟 I)
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int T = sc.nextInt(); while (T-- > 0) { int length = sc.nextInt(); String str1 = sc.next(); String str2 = sc.next(); boolean flag = true; for (int i = 0; i < length; i++) { if (str1.charAt(i) == str2.charAt(i)) { } else { if (str1.charAt(i) == 'O' && str2.charAt(i) == '0') { } else if (str1.charAt(i) == '0' && str2.charAt(i) == 'O') { } else if (str1.charAt(i) == 'I' && str2.charAt(i) == 'l') { } else if (str1.charAt(i) == 'l' && str2.charAt(i) == 'I') { } else { flag = false; System.out.println("NO"); break; } } } if (flag) System.out.println("OK"); } } } }