結果

問題 No.69 文字を自由に並び替え
ユーザー nCk_cvnCk_cv
提出日時 2016-02-01 20:00:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 584 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 71,904 KB
実行使用メモリ 56,120 KB
最終ジャッジ日時 2023-08-20 23:14:14
合計ジャッジ時間 4,566 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
56,028 KB
testcase_01 AC 112 ms
55,752 KB
testcase_02 AC 115 ms
55,656 KB
testcase_03 AC 114 ms
55,852 KB
testcase_04 AC 116 ms
55,736 KB
testcase_05 AC 116 ms
55,644 KB
testcase_06 AC 115 ms
55,968 KB
testcase_07 AC 116 ms
55,740 KB
testcase_08 AC 115 ms
56,120 KB
testcase_09 AC 117 ms
56,096 KB
testcase_10 AC 113 ms
55,752 KB
testcase_11 AC 116 ms
55,700 KB
testcase_12 AC 117 ms
55,640 KB
testcase_13 AC 114 ms
55,552 KB
testcase_14 AC 114 ms
55,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] A = sc.next().toCharArray();
		char[] B = sc.next().toCharArray();
		char[] countA = new char[26];
		char[] countB = new char[26];
		for(int i = 0; i < A.length; i++) {
			countA[A[i] - 'a']++; 
		}
		for(int i = 0; i < B.length; i++) {
			countB[B[i] - 'a']++;
		}
		for(int i = 0; i < 26; i++) {
			if(countA[i] != countB[i]) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}
0