import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String str1 = sc.nextLine().toUpperCase(); String str2 = sc.nextLine().toUpperCase(); Pattern compile = Pattern.compile("[\\w]"); Matcher matcher1 = compile.matcher(str1); Matcher matcher2 = compile.matcher(str2); String c1 = ""; String c2 = ""; while (matcher1.find()) { c1 += matcher1.group(0); } while (matcher2.find()) { c2 += matcher2.group(0); } if (c1.equals(c2)){ System.out.println("YES"); } else System.out.println("NO"); } } }
解题思路:
注意事项:
参考代码:
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:530 |
【密码】 (C语言代码)浏览:333 |
拆分位数 (C语言代码)浏览:1326 |
A+B for Input-Output Practice (III) (C语言代码)浏览:569 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:535 |
C语言训练-大、小写问题 (C语言代码)浏览:724 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:464 |
Hello, world! (C++代码)浏览:1744 |
C二级辅导-公约公倍 (C语言代码)浏览:481 |
Hello, world! (C语言代码)浏览:821 |