#include <iostream>
#include <map>
using namespace std;
map<char,int> mp;
map<pair<char,char>,bool> same;
map<char,char> mp2;
void set(string s,int a){
int b = a;
for (char i : s)
mp[i] = b,b = b * 10 + a;
for (int i : s)
for (int j : s)
same[{i,j}] = true;
}
int main() {
set("abc",2);
set("def",3);
set("ghi",4);
set("jkl",5);
set("mno",6);
set("pqrs",7);
set("tuv",8);
set("wxyz",9);
for (int i=1;i<=9;i++){
int a;
cin>>a;
mp2[(char(i + 48))] = char(a + 48);
}
mp2['#'] = '#';
string s,ss;
cin>>s;
int n = s.size();
s = '0' + s;
for (int i=1;i<=n;i++){
if (same[{s[i-1],s[i]}])
ss += '#';
int a = mp[s[i]];
for (char j : to_string(a))
ss += j;
}
for (char j : ss)
cout<<mp2[j];
cout<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |