結果

問題 No.69 文字を自由に並び替え
ユーザー HEGO55HEGO55
提出日時 2017-05-27 13:41:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 646 bytes
コンパイル時間 1,981 ms
コンパイル使用メモリ 71,820 KB
実行使用メモリ 56,152 KB
最終ジャッジ日時 2023-08-20 23:41:32
合計ジャッジ時間 4,730 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
55,940 KB
testcase_01 AC 116 ms
55,900 KB
testcase_02 AC 115 ms
55,988 KB
testcase_03 AC 115 ms
56,152 KB
testcase_04 AC 116 ms
56,032 KB
testcase_05 AC 117 ms
55,620 KB
testcase_06 AC 118 ms
55,816 KB
testcase_07 AC 115 ms
55,748 KB
testcase_08 AC 117 ms
55,848 KB
testcase_09 AC 114 ms
55,908 KB
testcase_10 AC 118 ms
55,528 KB
testcase_11 AC 115 ms
55,448 KB
testcase_12 AC 115 ms
55,976 KB
testcase_13 AC 114 ms
55,760 KB
testcase_14 AC 116 ms
55,504 KB
権限があれば一括ダウンロードができます

ソースコード

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