#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
map<char, pair<int, int>> m;
m['a'] = {2, 1};
m['b'] = {2, 2};
m['c'] = {2, 3};
m['d'] = {3, 1};
m['e'] = {3, 2};
m['f'] = {3, 3};
m['g'] = {4, 1};
m['h'] = {4, 2};
m['i'] = {4, 3};
m['j'] = {5, 1};
m['k'] = {5, 2};
m['l'] = {5, 3};
m['m'] = {6, 1};
m['n'] = {6, 2};
m['o'] = {6, 3};
m['p'] = {7, 1};
m['q'] = {7, 2};
m['r'] = {7, 3};
m['s'] = {7, 4};
m['t'] = {8, 1};
m['u'] = {8, 2};
m['v'] = {8, 3};
m['w'] = {9, 1};
m['x'] = {9, 2};
m['y'] = {9, 3};
m['z'] = {9, 4};
int a[10], b[10];
for(int i = 1; i <= 9; i++) {
cin >> a[i];
b[a[i]] = i;
}
string s;
cin >> s;
int X = -1;
for(int c : s) {
int x = m[c].first;
int y = m[c].second;
if(X == b[x]) {
cout << '#';
}
for(int i = 0; i < y; i++) {
cout << b[x];
}
X = b[x];
}
cout << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |