結果

問題 No.69 文字を自由に並び替え
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-26 21:21:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 1,033 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 74,756 KB
実行使用メモリ 33,736 KB
最終ジャッジ日時 2023-08-20 23:39:49
合計ジャッジ時間 3,327 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
33,308 KB
testcase_01 AC 38 ms
33,528 KB
testcase_02 AC 38 ms
33,324 KB
testcase_03 AC 37 ms
33,736 KB
testcase_04 AC 38 ms
33,236 KB
testcase_05 AC 37 ms
33,132 KB
testcase_06 AC 38 ms
33,316 KB
testcase_07 AC 38 ms
33,212 KB
testcase_08 AC 38 ms
33,368 KB
testcase_09 AC 38 ms
33,312 KB
testcase_10 AC 38 ms
33,332 KB
testcase_11 AC 38 ms
33,528 KB
testcase_12 AC 37 ms
33,284 KB
testcase_13 AC 37 ms
33,332 KB
testcase_14 AC 38 ms
33,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String A = reader.readLine();
        String B = reader.readLine();

        int[] as = new int[26];
        for (int i = 0; i < A.length(); i++) {
            as[A.charAt(i) - 'a'] += 1;
        }
        int[] bs = new int[26];
        for (int i = 0; i < B.length(); i++) {
            bs[B.charAt(i) - 'a'] += 1;
        }
        if(isSame(as,bs)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }

    }

    private static boolean isSame(int[] as, int[] bs) {
        for (int i = 0; i < 26; i++) {
            if (as[i] != bs[i]) {
                return false;
            }
        }
        return true;
    }


}

0