結果

問題 No.69 文字を自由に並び替え
ユーザー kou6839kou6839
提出日時 2014-11-19 14:00:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 758 bytes
コンパイル時間 3,741 ms
コンパイル使用メモリ 75,836 KB
実行使用メモリ 55,976 KB
最終ジャッジ日時 2023-08-20 22:30:19
合計ジャッジ時間 5,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
53,592 KB
testcase_01 AC 125 ms
55,556 KB
testcase_02 AC 123 ms
55,436 KB
testcase_03 AC 122 ms
55,552 KB
testcase_04 AC 123 ms
55,976 KB
testcase_05 AC 123 ms
39,464 KB
testcase_06 AC 124 ms
39,388 KB
testcase_07 AC 128 ms
39,340 KB
testcase_08 AC 126 ms
39,496 KB
testcase_09 AC 126 ms
39,116 KB
testcase_10 AC 123 ms
39,220 KB
testcase_11 AC 122 ms
39,344 KB
testcase_12 AC 122 ms
38,996 KB
testcase_13 AC 123 ms
39,348 KB
testcase_14 AC 127 ms
39,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a=sc.next();
		String b=sc.next();
		HashMap<Character,Integer> aa=new HashMap<>();
		HashMap<Character,Integer> bb=new HashMap<>();
		for(int i=0;i<a.length();i++){
			if(!aa.containsKey(a.charAt(i))){
				aa.put(a.charAt(i), 0);
			}else{
				aa.put(a.charAt(i), aa.get(a.charAt(i))+1);
			}
			if(!bb.containsKey(b.charAt(i))){
				bb.put(b.charAt(i), 0);
			}else{
				bb.put(b.charAt(i), bb.get(b.charAt(i))+1);
			}	
		}
		for(Character g:aa.keySet()){
			if(!bb.containsKey(g)||aa.get(g)!=bb.get(g)){
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}
0