https://programmers.co.kr/learn/courses/30/lessons/81301
c++ 풀이(map)
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int solution(string s) {
int answer = 0;
unordered_map <string,char> mp;
mp["zero"]='0';mp["one"]='1';mp["two"]='2';mp["three"]='3';mp["four"]='4';mp["five"]='5';
mp["six"]='6';mp["seven"]='7';mp["eight"]='8';mp["nine"]='9';
string ans = "";
int idx=0;
while(idx<s.size())
{
if(s[idx]>='0' && s[idx]<='9')
{
ans.push_back(s[idx]);
idx++;
}
else
{
string tmp="";
while(s[idx]>='a'&&s[idx]<='z')
{
tmp.push_back(s[idx++]);
if(mp[tmp]>='0' && mp[tmp]<='9') break;
}
ans.push_back(mp[tmp]);
}
}
answer=stoi(ans);
return answer;
}