-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08_Map_27.cpp
More file actions
38 lines (38 loc) · 1.17 KB
/
Copy path08_Map_27.cpp
File metadata and controls
38 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <bits/stdc++.h>
using namespace std;
int main(){
map<int,string> m={{2,"a"},{22,"b"},{222,"c"},
{3,"d"},{33,"e"},{333,"f"},{4,"g"},{44,"h"},{444,"i"},
{5,"j"},{55,"k"},{555,"l"},{6,"m"},{66,"n"},{666,"o"},
{7,"p"},{77,"q"},{777,"r"},{7777,"s"},{8,"t"},{88,"u"},
{888,"v"},{9,"w"},{99,"x"},{999,"y"},{9999,"z"},{0," "}};
string input;
while(getline(cin,input)){
if(input.substr(0,3)=="T2K"){
string ans="";
input=input.substr(4);
for(int i=0;i<input.length();i++){
for(auto k : m){
if(to_string(k.second)==input[i]){
ans+=k.first+" ";
}
}
}
cout << ">> " << ans << endl;
}else{
input=input.substr(4);
istringstream iss(input);
string word;
string ans="";
while(iss>>word){
for(auto i : m){
if(i.first==stoi(word)){
ans+=i.second;
}
}
}
cout << ">> " << ans << endl;
}
}
return 0;
}