본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 1972번 놀라운 문자열

by 현장 2022. 5. 15.

-Code

while 1:
    s = input()
    if s == '*':
        break
    flag = True
    for i in range(1, len(s)):
        arr = []
        for j in range(len(s) - i):
            line = s[j] + s[j + i]
            j += i
            arr.append(line)
        if len(arr) != len(set(arr)):
            flag = False
            break

    if flag:
        print(f"{s} is surprising.")
    else:
        print(f"{s} is NOT surprising.")