結果

問題 No.69 文字を自由に並び替え
ユーザー koukonkokoukonko
提出日時 2015-12-10 12:22:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 843 bytes
コンパイル時間 1,970 ms
コンパイル使用メモリ 78,388 KB
実行使用メモリ 50,048 KB
最終ジャッジ日時 2023-08-20 23:11:59
合計ジャッジ時間 3,445 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
50,048 KB
testcase_01 AC 45 ms
49,660 KB
testcase_02 AC 45 ms
49,824 KB
testcase_03 AC 46 ms
49,672 KB
testcase_04 AC 45 ms
47,608 KB
testcase_05 AC 46 ms
49,656 KB
testcase_06 AC 45 ms
49,700 KB
testcase_07 AC 45 ms
49,764 KB
testcase_08 AC 44 ms
49,840 KB
testcase_09 AC 46 ms
49,708 KB
testcase_10 AC 44 ms
49,652 KB
testcase_11 AC 45 ms
49,672 KB
testcase_12 AC 46 ms
49,532 KB
testcase_13 AC 45 ms
49,856 KB
testcase_14 AC 45 ms
49,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));

		try {
			String first = buff.readLine();
			String second = buff.readLine();
			StringBuilder build = new StringBuilder(second);

			for(int i = 0; i < first.length(); ++i){
				char ch = first.charAt(i);
				if(build.indexOf(ch+"") == -1){
					break;
				}else{
					build.deleteCharAt(build.indexOf(ch+""));
				}
			}

			if(build.toString().length() > 0){
				System.out.println("NO");
			}else{
				System.out.println("YES");
			}

		} catch (NumberFormatException e) {
			e.getStackTrace();
		} catch (IOException e) {
			e.getStackTrace();
		} catch (Exception e) {
			e.getStackTrace();
		}
	}
}
0