参考代码:
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char []s1 = scanner.nextLine().replaceAll(" ", "").toLowerCase().toCharArray(); char []s2 = scanner.nextLine().replaceAll(" ", "").toLowerCase().toCharArray(); Arrays.sort(s1); Arrays.sort(s2); System.out.print(Arrays.toString(s1).equals(Arrays.toString(s2)) ? "YES" : "NO"); } }
0.0分
4 人评分