結果

問題 No.69 文字を自由に並び替え
ユーザー SuunnSuunn
提出日時 2018-11-20 05:47:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 2,141 ms
コンパイル使用メモリ 71,436 KB
実行使用メモリ 56,036 KB
最終ジャッジ日時 2023-08-21 00:10:30
合計ジャッジ時間 4,634 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,036 KB
testcase_01 AC 118 ms
55,800 KB
testcase_02 AC 118 ms
55,632 KB
testcase_03 AC 118 ms
55,520 KB
testcase_04 AC 118 ms
55,708 KB
testcase_05 AC 121 ms
55,612 KB
testcase_06 AC 117 ms
55,640 KB
testcase_07 AC 118 ms
55,612 KB
testcase_08 AC 120 ms
55,612 KB
testcase_09 AC 118 ms
55,428 KB
testcase_10 AC 118 ms
56,020 KB
testcase_11 AC 119 ms
55,776 KB
testcase_12 AC 119 ms
55,620 KB
testcase_13 AC 118 ms
55,336 KB
testcase_14 AC 119 ms
55,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
	

public class Main{
	
	
	public static void main(String args[])throws Exception{
		
		Scanner sc = new Scanner(System.in);
		String A = sc.next();
		String B = sc.next();
		int L = A.length();
		char[] a = new char[26];
		char[] b = new char[26];
		for(int i=0;i<L;i++){
			a[A.charAt(i)-'a']++;
			b[B.charAt(i)-'a']++;
		}
		for(int i=0;i<26;i++){
			if(a[i]!=b[i]){
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}
0