結果

問題 No.69 文字を自由に並び替え
ユーザー ohagi_1182ohagi_1182
提出日時 2017-10-21 10:24:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 530 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 71,980 KB
実行使用メモリ 55,932 KB
最終ジャッジ日時 2023-08-20 23:50:15
合計ジャッジ時間 5,042 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,204 KB
testcase_01 AC 114 ms
53,944 KB
testcase_02 AC 112 ms
55,932 KB
testcase_03 AC 115 ms
55,472 KB
testcase_04 AC 112 ms
55,652 KB
testcase_05 AC 114 ms
55,520 KB
testcase_06 AC 115 ms
55,588 KB
testcase_07 AC 113 ms
55,480 KB
testcase_08 AC 113 ms
55,780 KB
testcase_09 AC 113 ms
55,644 KB
testcase_10 AC 113 ms
55,832 KB
testcase_11 AC 113 ms
55,476 KB
testcase_12 AC 113 ms
55,456 KB
testcase_13 AC 114 ms
55,244 KB
testcase_14 AC 115 ms
55,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		if(a.length() != b.length()) {
			System.out.println("NO");
			return;
		}
		char[] s1 = a.toCharArray();
		char[] s2 = b.toCharArray();
		Arrays.sort(s1); Arrays.sort(s2);
		for(int i = 0 ; i < a.length() ; i++) {
			if(s1[i] != s2[i]) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
 	}
}

0