https://school.programmers.co.kr/learn/courses/30/lessons/155652
python
def solution(s: str, skip:str, index:int) -> str:
alphabets = "abcdefghijklmnopqrstuvwxyz"
alphabet_index = {c: idx for idx, c in enumerate(alphabets)}
index_alphabet = {idx: (c, False) if c in skip else (c, True) for idx, c in enumerate(alphabets)}
result = []
for c in s:
count = 0
idx = alphabet_index[c]
while count != index:
idx = (idx + 1) % 26
next_c, is_valid = index_alphabet[idx]
if is_valid:
count += 1
result.append(index_alphabet[idx][0])
return "".join(result)
if __name__ == "__main__":
result = solution("aukks", "wbqd", 5)
print(result)
print(result == "happy")
happy
True
안녕하세요, 99클럽 그룹 리더 휴입니다!
회고를 작성하신 부분이 좋네요. 잘 읽고 갑니다.
앞으로도 힘내서 매일 TIL 도전해 보세요! 화이팅입니다 :)
==
99클럽 https://bit.ly/3TN5TBL