結果
問題 |
No.69 文字を自由に並び替え
|
ユーザー |
![]() |
提出日時 | 2016-01-20 00:58:08 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 588 bytes |
コンパイル時間 | 3,362 ms |
コンパイル使用メモリ | 75,360 KB |
実行使用メモリ | 54,180 KB |
最終ジャッジ日時 | 2024-06-27 13:16:08 |
合計ジャッジ時間 | 6,034 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 5 |
ソースコード
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(); } }