요깨비's LAB

[백준, Brute-force, Kotlin] P.9093 단어뒤집기 본문

알고리즘(Kotlin)/Brute-Force

[백준, Brute-force, Kotlin] P.9093 단어뒤집기

요깨비 2021. 5. 28. 12:38

 

import java.util.*

fun main() {
    val scr = Scanner(System.`in`)
    val T = scr.nextInt()
    scr.nextLine()

    val sb = StringBuffer()
    for(i in 0 until T) {
        val str = scr.nextLine()

        val elements = str.split(" ")

        for(element in elements) {
            sb.append(element.reversed() + " ")
        }

        sb.append("\n")
    }

    print(sb.toString())
}
Comments