난이도: Silver 4
프로그래밍 언어: Kotlin
문제명: 베스트셀러
푼일자: 2022년 1월
주소: https://www.acmicpc.net/problem/1302
문제풀기
fun main() = with(System.`in`.bufferedReader()) {
val map = mutableMapOf<String, Int>()
repeat(readLine().toInt()) {
val book = readLine()
map[book] = (map[book] ?: 0) + 1
}
print(map.toSortedMap().maxByOrNull { it.value }!!.key)
}
반응형