[BOJ / Python] 10988 펠린드롬인지 확인하기

도니·2023년 4월 6일

BOJ / Python

목록 보기
37/105
post-thumbnail

문제

백준 10988 펠린드롬인지 확인하기

코드

#BOJ 10988 펠린드롬인지 확인하기

word = list(input())
length = len(word)

palindrom = 1
for i in range(length//2):
    if word[i] != word[length-i-1]:
        palindrom = 0
        break

print(palindrom)

펠린드롬(palindrom, 회문(回文)): 역순으로 읽어도 같은 말이 되는 말

백준 10811 바구니 뒤집기 문제와 비슷한 알고리즘을 사용하였다.
[BOJ / Python] 10811 바구니 뒤집기

profile
Where there's a will, there's a way

0개의 댓글