包昌鹏


私信TA

用户名:GZEIC110

访问量:217

签 名:

等  级
排  名 2479
经  验 2193
参赛次数 1
文章发表 3
年  龄 0
在职情况 学生
学  校 贵电大数据系
专  业

  自我简介:

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 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区