26560번: Periods백준/문제2024. 7. 26. 13:53
Table of Contents
문제 출처 : https://www.acmicpc.net/problem/26560
언어 : Kotlin
문제 설명 :
Eric gets distracted so sometimes he forgets to put periods at the end of his sentences. To help him out, you are to put a period at the end of his sentences if the period is not already present.
입력 :
The first line of input will contain a single integer n that indicates the number of lines to follow. Each line will consist of a sentence which may or may not have a period at the end.
출력 :
Output the sentence, making sure there is one period at the end.
제한 사항 :
- 시간 제한 : 1초
- 메모리 제한 : 1024MB
입출력 예 :
입력 | 출력 |
3 You kicked my dog No I did not. It was the kid that did |
You kicked my dog. No I did not. It was the kid that did. |
풀이 :
import java.io.BufferedReader
import java.io.BufferedWriter
import java.io.InputStreamReader
import java.io.OutputStreamWriter
fun main() = with(BufferedReader(InputStreamReader(System.`in`))) {
val bw = BufferedWriter(OutputStreamWriter(System.out))
repeat(readLine().toInt()) {
val cur = readLine()
bw.write(if (cur.last() != '.') cur.padEnd(cur.length + 1, '.') else cur)
bw.newLine()
}
bw.flush()
bw.close()
}
'백준 > 문제' 카테고리의 다른 글
18245번: 이상한 나라의 암호 (0) | 2024.07.30 |
---|---|
12174번: #include <Google I/O.h> (0) | 2024.07.26 |
4446번: ROT13 (1) | 2024.07.25 |
16205번: 변수명 (1) | 2024.07.25 |
10932번: SHA-512 (0) | 2024.07.24 |
@스몰스테핑 :: 작은 발걸음
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!