結果

問題 No.69 文字を自由に並び替え
コンテスト
ユーザー megane_anko
提出日時 2021-03-10 22:33:23
言語 TypeScript
(6.0.2)
コンパイル:
tsc.sh -p tsconfig.json
実行:
node main.js ONLINE_JUDGE
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 636 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,641 ms
コンパイル使用メモリ 348,088 KB
実行使用メモリ 53,228 KB
最終ジャッジ日時 2026-06-05 05:31:59
合計ジャッジ時間 7,092 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import * as fs from 'fs';
const input = fs.readFileSync('/dev/stdin', 'utf8');

const nlarray = input.split('\n');
const Aarray = nlarray[0].split('');
const Barray = nlarray[1].split('');

Aarray.sort();
Barray.sort();

// let sum = 0;
// for (let i = 0;i < Aarray.length; i++) {
//     if (Aarray[i] === Barray[i]) {
//         sum += 1;
//     }
// }
// if (sum === Aarray.length) {
//     console.log('YES');
// } else {
//     console.log('NO');
// }

let result = 'YES';

for (let i = 0;i < Aarray.length; i++) {
    if (Aarray[i] === Barray[i]) {
        continue;
    } else {
        result = 'NO';
    }
}
console.log(result);
0