https://www.acmicpc.net/problem/9093

 

9093번: 단어 뒤집기

첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 문장이 하나 주어진다. 단어의 길이는 최대 20, 문장의 길이는 최대 1000이다. 단어와 단어 사이에는

www.acmicpc.net

 

 

[난이도] Bronze1
[유형] 구현

[풀이]
reversed 함수를 이용해 뒤집기

 

import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*
fun main() = with(BufferedReader(InputStreamReader(System.`in`))){
    var n = readLine().toInt()
    while(n-->0){
        var sp = readLine().split(" ");
        for(a in sp){
            print(a.reversed()+' ')
        }
        println()
    }
}

 


https://github.com/has2/Problem-Solving/blob/master/boj-solved.ac/Bronze1/9093.cpp

+ Recent posts