解题思路:
注意事项:
参考代码:
public class Test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s1 = scanner.nextLine();
String s2 = scanner.nextLine();
System.out.println(removeSpace(s1).equals(removeSpace(s2)) ? "YES" : "NO");
}
public static String removeSpace(String s) {
s = s.toLowerCase();//变为小写
char[] chars = new char[s.length()];
int i = 0, index = 0;
while (index < s.length()) {
if (s.charAt(index) != ' ') {
chars[i++] = s.charAt(index);
}
index++;
}
String str = new String(chars);
return str.substring(0, i);
}
}
0.0分
0 人评分