Home [1일 1문제] 3월 22일 문제풀이
Post
Cancel

[1일 1문제] 3월 22일 문제풀이

✏️백준 1259번 :팰린드롬수

문제

나의 풀이

- Swift

1
2
3
4
5
6
7
8
9
10
11
while true {
    let n = readLine()!
    if n == "0" {
        break
    }
    if n == String(n.reversed()) {
        print("yes")
    } else {
        print("no")
    }
}

- Python

1
2
3
4
5
6
7
8
9
10
11
12
import sys
input = sys.stdin.readline

while True:
    num = input().strip()
    if num == "0":
        break

    if num == num[::-1]:
        print("yes")
    else:
        print("no")
This post is licensed under CC BY 4.0 by the author.