結果

問題 No.69 文字を自由に並び替え
ユーザー r.suzukir.suzuki
提出日時 2016-01-20 00:58:08
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 588 bytes
コンパイル時間 3,540 ms
コンパイル使用メモリ 72,912 KB
実行使用メモリ 57,896 KB
最終ジャッジ日時 2023-09-09 20:44:18
合計ジャッジ時間 6,416 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,668 KB
testcase_01 WA -
testcase_02 AC 115 ms
55,668 KB
testcase_03 AC 114 ms
55,620 KB
testcase_04 WA -
testcase_05 AC 115 ms
55,696 KB
testcase_06 AC 115 ms
55,668 KB
testcase_07 AC 116 ms
55,688 KB
testcase_08 AC 115 ms
55,412 KB
testcase_09 WA -
testcase_10 AC 118 ms
55,784 KB
testcase_11 AC 117 ms
53,776 KB
testcase_12 AC 120 ms
55,628 KB
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;

public class No_69{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		HashSet<String> set = new HashSet<String>();

		String s1,s2,ans,tmp;
		s1 = sc.next();
		s2 = sc.next();
		ans = "YES";
		tmp = "";
		
		if(s1.equals(s2)){
			System.out.println(ans);
			System.exit(0);
		}

		for (int i = 0; i < s1.length(); i++) {
			tmp = s1.substring(i,i+1);
			if(set.add(tmp)){
				continue;
			}
			if (!s2.contains(tmp)){
				ans = "NO";
				break;
			}
		}

		System.out.println(ans);
		sc.close();

	}
}
0