Skip to content

Instantly share code, notes, and snippets.

@mikaello
Last active September 30, 2022 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaello/4900fcbd55ff34c7f8c84f3a2d75bca2 to your computer and use it in GitHub Desktop.
Save mikaello/4900fcbd55ff34c7f8c84f3a2d75bca2 to your computer and use it in GitHub Desktop.
Read stdin with Kotlin, util for Kattis input parsing
fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }
fun readDouble() = readString().toDouble()
fun readDoubles() = readStrings().map { it.toDouble() }
fun main(){
val (a,b) = readInts()
println(a+b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment