Baekjoon #4096

Baekjoon #4096

1개의 풀이 · Python

문제 원문 보기 ↗

SOLUTION INFO

Python · main.py

main.py
import sys
def input():
    return sys.stdin.readline().rstrip()

def isPalindrome(s):
    return s == s[::-1]

while True:
    N = input()
    length = len(N)
    ct = 0
    if N == '0':
        break
    elif isPalindrome(N):
        print(0)
    else:
        while True:
            if isPalindrome(N):
                print(ct)
                break
            N = str(int(N)+1)
            N = '0' * (length - len(N)) + N
            ct += 1

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.