https://www.acmicpc.net/problem/4659
4659번: 비밀번호 발음하기
좋은 패스워드를 만드는것은 어려운 일이다. 대부분의 사용자들은 buddy처럼 발음하기 좋고 기억하기 쉬운 패스워드를 원하나, 이런 패스워드들은 보안의 문제가 발생한다. 어떤 사이트들은 xvtp
www.acmicpc.net
'''
모음(a,e,i,o,u) 하나를 반드시 포함하여야 한다.
모음이 3개 혹은 자음이 3개 연속으로 오면 안 된다.
같은 글자가 연속적으로 두번 오면 안되나, ee 와 oo는 허용한다.
'''
import sys
input = sys.stdin.readline
def f(password):
# 1. 모음(a,e,i,o,u) 하나를 반드시 포함하여야 한다.
gather = ['a','e','i','o','u']
flag = 0
for p in password:
if p in gather:
flag = 1
if flag == 0:
return print(f'<{password}> is not acceptable.')
# 2. 모음이 3개 혹은 자음이 3개 연속으로 오면 안 된다.
g_cnt, c_cnt = 0, 0
for p in password:
if p in gather:
c_cnt = 0
g_cnt += 1
else:
g_cnt = 0
c_cnt += 1
if g_cnt >= 3 or c_cnt >= 3:
return print(f'<{password}> is not acceptable.')
# 3. 같은 글자가 연속적으로 두번 오면 안되나, ee 와 oo는 허용한다.
for i in range(len(password)-1):
if password[i] == password[i+1] and password[i] not in ['e', 'o']:
return print(f'<{password}> is not acceptable.')
return print(f'<{password}> is acceptable.')
while True:
password = input().rstrip()
if password == 'end':
break
else:
f(password)
'백준' 카테고리의 다른 글
백준 7567. 그릇 (0) | 2024.03.29 |
---|---|
백준 1205. 등수 구하기 (0) | 2024.03.27 |
백준 7568. 덩치 (0) | 2024.03.25 |
백준 8979. 올림픽 (0) | 2024.03.25 |
백준 11557. Yangjojang of The Year (0) | 2024.03.25 |