T-coding
백준 4659 비밀번호 발음하기 / Python 본문
728x90
728x90
https://www.acmicpc.net/problem/4659
4659번: 비밀번호 발음하기
좋은 패스워드를 만드는것은 어려운 일이다. 대부분의 사용자들은 buddy처럼 발음하기 좋고 기억하기 쉬운 패스워드를 원하나, 이런 패스워드들은 보안의 문제가 발생한다. 어떤 사이트들은 xvtp
www.acmicpc.net

풀이
더보기
vowel = ['a', 'e', 'i', 'o', 'u']
while True:
s = input()
if s == "end":
break
v_cnt = 0
v_repeat, c_repeat = 0, 0
last = ''
flag = True
for i in s:
if i in vowel:
if v_repeat == 2 or ((i != 'e' and i != 'o') and last == i):
flag = False
break
else:
v_repeat += 1
c_repeat = 0
v_cnt += 1
last = i
else:
if c_repeat == 2 or last == i:
flag = False
break
else:
c_repeat += 1
v_repeat = 0
last = i
if v_cnt == 0:
flag = False
if flag:
print("<{}> is acceptable.".format(s))
else:
print("<{}> is not acceptable.".format(s))
728x90
300x250
'Baekjoon' 카테고리의 다른 글
백준 25206 너의 평점은 / Python (0) | 2023.03.16 |
---|---|
백준 5347 LCM / Python (0) | 2023.03.16 |
백준 1107 리모컨 / C++ (0) | 2022.11.30 |
백준 1188 음식 평론가 / C++ (0) | 2022.11.30 |
백준 1662 압축 / C++ (0) | 2022.11.30 |