Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Swift
- weak
- 프로퍼티
- 생명주기
- View
- ios
- RxSwift
- 프래그먼트
- 안드로이드
- 해시
- observable
- 스위프트
- 이스케이핑
- 옵셔널
- 프로그래머스
- Subject
- concurrency
- 알고리즘
- async
- rx
- 구조체
- 백준
- 리스트뷰
- 차이
- 클로저
- noncopyable
- 풀이
- 자바
- Self
- 연산자
Archives
- Today
- Total
study record
백준 9093 - 스위프트 풀이 본문
let n: Int = Int(readLine()!)!
var str: String = ""
for _ in 0..<n {
let input = readLine()!
let arr = input.split(separator: " ")
for word in arr {
var wordStr = ""
for c in word {
wordStr = String(c) + wordStr
}
str += wordStr + " "
}
str += "\n"
}
print(str)
다른 사람의 깔끔한 풀이
let t = Int(readLine()!)!
for _ in 0..<t {
let words = readLine()!.split(separator: " ").map{String($0)}
var arr = [String]()
for word in words {
var temp = ""
for str in word.reversed() {
temp += String(str)
}
arr.append(temp)
}
let result = arr.joined(separator: " ")
print(result)
}
'알고리즘 > 스위프트 알고리즘' 카테고리의 다른 글
백준 2740 - 스위프트 풀이 (0) | 2022.02.06 |
---|---|
백준 1292 - 스위프트 풀이 (0) | 2022.02.04 |