백준 1259 펠린드롬수
문제 : https://www.acmicpc.net/problem/1259
Swift :
var input = readLine()!
while input != "0"{
print(isPalin(input) ? "yes" : "no")
input = readLine()!
}
func isPalin(_ str: String) -> Bool{
let arr = str.map{String($0)}
var res = true
for i in 0..<arr.count/2{
if arr[i] != arr[arr.count-1-i]{
res = false
}
}
return res
}