結果

問題 No.69 文字を自由に並び替え
ユーザー rutilicus
提出日時 2020-08-30 22:10:52
言語 Kotlin
(2.1.0)
結果
AC  
実行時間 314 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 11,729 ms
コンパイル使用メモリ 435,244 KB
実行使用メモリ 51,420 KB
最終ジャッジ日時 2024-11-15 15:40:43
合計ジャッジ時間 17,566 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:15:13: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln(if ((0..('z' - 'a')).all { aCnt[it] == bCnt[it] }) "YES" else "NO")
            ^

ソースコード

diff #

fun main() {
    val builder = StringBuilder()

    val aCnt = IntArray('z' - 'a' + 1)
    val bCnt = IntArray('z' - 'a' + 1)

    readInputLine().forEach {
        aCnt[it - 'a']++
    }

    readInputLine().forEach {
        bCnt[it - 'a']++
    }

    builder.appendln(if ((0..('z' - 'a')).all { aCnt[it] == bCnt[it] }) "YES" else "NO")

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}
0