結果

問題 No.69 文字を自由に並び替え
ユーザー HEGO55
提出日時 2017-05-27 13:41:47
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 646 bytes
コンパイル時間 2,556 ms
コンパイル使用メモリ 74,432 KB
実行使用メモリ 41,544 KB
最終ジャッジ日時 2024-12-14 06:37:34
合計ジャッジ時間 4,929 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class No69{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int count = 0;
		
		String str1 = sc.next(); char[] c1 = str1.toCharArray();
		String str2 = sc.next(); char[] c2 = str2.toCharArray();
		
	    if(c1.length == c2.length){
			for(int i=0; i<str1.length(); i++){
				for(int j=0; j<str2.length(); j++){
					if(c1[i] == c2[j]){
						c1[i] = '0';
						c2[j] = '0';
					}
				}
			}
	    }
		
		for(int i=0; i<str1.length(); i++){
			if(c1[i] == '0'){
				count++;
			}
		}
		
		if(count == str1.length()){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}
0