#백준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))
'기술' 카테고리의 다른 글
전화번호 목록 - 프로그래머스 해시 문제 (0) | 2021.04.05 |
---|---|
완주하지 못한 선수 - 프로그래머스 해시 문제 (0) | 2021.04.05 |
직사각형에서 탈출 - 백준1085번 (0) | 2021.04.05 |
이항계수1 - 백준11050번 (0) | 2021.04.05 |
블랙잭 - 백준2798번 (0) | 2021.04.05 |