문제: 무단 배포 금지로 인해 사이트 주소로 남깁니다.
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5P1kNKAl8DFAUq
정답 코드(예외 처리함):
T = int(input())
for test_case in range(1, T + 1):
s = input()
temp = ''
flag = True
for i in s:
temp += i
index = len(temp)
while True:
#2번째 예시가 적절치 않아 야매로 -5 기입.
if index >= len(s) - 5:
break
if temp != s[index:index+len(temp)]:
flag = False
break
index += len(temp)
if flag:
break
flag = True
print(f"#{test_case}", len(temp))
'SWEA' 카테고리의 다른 글
1210. [S/W 문제해결 기본] 2일차 - Ladder1 (2) | 2024.07.16 |
---|---|
5215. 햄버거 다이어트 (0) | 2024.07.15 |
1284. 수도 요금 경쟁 (0) | 2024.07.15 |
1945. 간단한 소인수분해 (0) | 2024.07.15 |
1954 .달팽이 숫자 (0) | 2024.07.15 |