結果

問題 No.69 文字を自由に並び替え
ユーザー yagi2
提出日時 2017-04-25 16:41:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 591 bytes
コンパイル時間 2,344 ms
コンパイル使用メモリ 75,736 KB
実行使用メモリ 54,116 KB
最終ジャッジ日時 2024-12-14 06:35:06
合計ジャッジ時間 5,196 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        HashMap<String, Integer> A = input(sc);
        HashMap<String, Integer> B = input(sc);

        System.out.println((A.equals(B))? "YES" : "NO");
    }

    private static HashMap<String, Integer> input(Scanner sc) {
        HashMap<String, Integer> res = new HashMap<>();
        for (String s : sc.next().split("")) {
            if (!res.containsKey(s)) res.put(s, 0);
            res.put(s, res.get(s) + 1);
        }

        return res;
    }
}
0