[Programmers] ์ซ์ ๋ฌธ์์ด๊ณผ ์๋จ์ด
ยท
๐ฏ CodingTest/Programmers
def solution(s): words = {'zero': '0', 'one':'1', 'two':'2', 'three':'3','four':'4', 'five':'5', 'six':'6', 'seven':'7','eight':'8','nine':'9'} temp = '' answer = '' for c in s: if c in words.values() : answer += c else: temp += c if temp in words.keys() : answer += words[temp] temp = '' return int(answer) ์ด๊ธฐ words ๋์
๋๋ฆฌ์ ์ซ์์ ์๋ฌธํ๊ธฐ๋ฅผ ํค๋กํ๊ณ ์ซ์(๋ฌธ์์ด)๋ฅผ ๊ฐ์ผ๋ก ๊ฐ์ง๋ ๋์
๋๋ฆฌ๋ก ์ด๊ธฐํ temp ๋ฌธ์์ด๊ณผ answer ๋ฌธ์์ด ์ ์ธ ๋ฐ ๊ฐ๊ฐ ๋น ๋ฌธ์..