기술

팰린드롬수 - 백준1259번

기술 공간 2021. 4. 5. 02:37
#백준1259번

def palin(l):
    tmp2=[]
    palin_check=True
    for i2 in range(0,len(l)):
        tmp2.append(l[i2])
    for i3 in range(0,(len(l)//2)+1):
        if tmp2[i3]==tmp2[(len(tmp2)-1)-i3]:
            continue
        else :
            palin_check=False
            break

    if palin_check==True:
        return 'yes'
    else :
        return 'no'

input_lst=[]
while(1):
    tmp=input()
    if tmp=='0' :
        break
    else :
        input_lst.append(list(tmp))

for i in range(0,len(input_lst)):
    print(palin(input_lst[i]))



#백준1259번 다른사람 풀이
import sys

def my_palindrome(str):
    length = len(str)
    for i in range(0, length):
        if(str[i] != str[length - 1 - i]):
            return "no"

    return "yes"

while(True):
    text = sys.stdin.readline().strip()
    if text == '0':
        break
    print(my_palindrome(text))