public static void main(String[] args) { Scanner in = new Scanner(System.in); String num = in.nextLine(); int n = Integer.parseInt(num); if(n<1 || n>100000){ return; } String s = in.nextLine(); String t = in.nextLine(); if(s.length() != n || t.length() != n){ return ; } int res = getResult(n, s, t); System.out.println(res); } private static int getResult(int n, String s, String t) { int res = 0; char[] chars = s.toCharArray(); char[] chart = t.toCharArray(); for(int i=0; i<n; i++){ if(chars[i] != chart[i]){ res++; } } return res; }
全部评论
(4) 回帖