Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import kotlin.system.exitProcess
- fun main() {
- readLine()
- mutableMapOf<Int, Int>().let { map ->
- var maxKey = 0
- val vec = readLine()!!.trim().split(' ').map { it.toInt() }
- vec.forEach {
- map[it] = map.getOrPut(it) { 0 } + 1
- if (map[it]!! > maxKey)
- maxKey = map[it]!!
- }
- mutableMapOf<Int, Int>().let { map2 ->
- vec.forEach {
- map2[it] = map2.getOrPut(it) { 0 } + 1
- if (map2[it]!! == maxKey) {
- println(it)
- exitProcess(0)
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement