結果
問題 |
No.69 文字を自由に並び替え
|
ユーザー |
|
提出日時 | 2025-05-05 08:11:12 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,191 bytes |
コンパイル時間 | 2,494 ms |
コンパイル使用メモリ | 78,988 KB |
実行使用メモリ | 51,244 KB |
最終ジャッジ日時 | 2025-05-05 08:11:16 |
合計ジャッジ時間 | 4,026 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 WA * 1 |
ソースコード
import java.io.*; // 処理 class Process { private String A; private String B; Process(String A, String B) { this.A = A; this.B = B; } String getResult() { if(A.equals(B)) { return "YES"; } int[] alphabetCounts = new int[26]; for(int i = 0; i < A.length(); i++) { alphabetCounts[A.charAt(i) - 'a']++; alphabetCounts[B.charAt(i) - 'a']++; } for(int i = 0; i < alphabetCounts.length; i++) { if(alphabetCounts[i] % 2 == 1) { return "NO"; } } return "YES"; } } public class Main { public static void main(String[] args) throws IOException { var bufferedReader = new BufferedReader(new InputStreamReader(System.in)); var printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); // 入力 String A = bufferedReader.readLine().trim(); String B = bufferedReader.readLine().trim(); // 出力 printWriter.println((new Process(A, B)).getResult()); bufferedReader.close(); printWriter.close(); } }