728x90
덧셈식 출력하기
fun main(args: Array<String>) {
val (a, b) = readLine()!!.split(' ').map(String::toInt)
println("$a + $b = ${a + b}")
}
문자열 붙여서 출력하기
fun main(args: Array<String>) {
val input = readLine()!!.split(' ')
val s1 = input[0]
val s2 = input[1]
println(s1+s2)
}
문자열 돌리기
fun main(args: Array<String>) {
val s1 = readLine()!!
s1.map{
println(it)
}
}
홀짝 구분하기
fun main(args: Array<String>) {
val a = readLine()!!.toInt()
if(a % 2 == 0) println("$a is even")
else println("$a is odd")
}
문자열 겹쳐쓰기
class Solution {
fun solution(my_string: String, overwrite_string: String, s: Int): String
= my_string.slice(0 until s) + overwrite_string + my_string.slice(overwrite_string.length + s until my_string.length)
}
728x90