#include<bits/stdc++.h>
using namespace std;
string c[27] = {
"2", "22", "222", "3", "33", "333", "4", "44", "444",
"5", "55", "555", "6", "66", "666", "7", "77", "777", "7777",
"8", "88", "888", "9", "99", "999", "9999"
};
map<int, int> m;
int main() {
for (int i = 1; i <= 9; i++) {
int a; cin >> a;
m[a] = i;
}
string s; cin >> s;
string p;
for (char a: s) {
if (c[a-'a'][0] == p[0]) cout << '#';
for (char b: c[a-'a']) cout << m[b-'0'];
p = c[a-'a'];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
436 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |