結果
問題 |
No.69 文字を自由に並び替え
|
ユーザー |
|
提出日時 | 2025-05-05 08:26:44 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 51 ms / 5,000 ms |
コード長 | 1,325 bytes |
コンパイル時間 | 2,298 ms |
コンパイル使用メモリ | 78,716 KB |
実行使用メモリ | 38,268 KB |
最終ジャッジ日時 | 2025-05-05 08:26:48 |
合計ジャッジ時間 | 4,002 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
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[] alphabetCountsOfA = new int[26]; for(int i = 0; i < A.length(); i++) { alphabetCountsOfA[A.charAt(i) - 'a']++; } int[] alphabetCountsOfB = new int[26]; for(int i = 0; i < B.length(); i++) { alphabetCountsOfB[B.charAt(i) - 'a']++; } for(int i = 0; i < alphabetCountsOfA.length; i++) { if(alphabetCountsOfA[i] != alphabetCountsOfB[i]) { 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(); } }