結果

問題 No.69 文字を自由に並び替え
ユーザー nCk_cv
提出日時 2016-02-01 20:00:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 584 bytes
コンパイル時間 2,321 ms
コンパイル使用メモリ 74,644 KB
実行使用メモリ 54,288 KB
最終ジャッジ日時 2024-12-14 06:09:40
合計ジャッジ時間 4,783 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

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