#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<string> perm = {
"",
"",
"abc",
"def",
"ghi",
"jkl",
"mno",
"pqrs",
"tuv",
"wxyz"
};
vector<int> act(10);
for (int i = 1; i <= 9; i++)
cin >> act[i];
string s;
cin >> s;
int prev = -1;
for (char c : s) {
int id, num;
for (int i = 1; i <= 9; i++) {
for (int j = 0; j < perm[act[i]].size(); j++) {
if (perm[act[i]][j] == c)
id = i, num = j;
}
}
if (id == prev)
cout << "#";
for (int i = 0; i <= num; i++)
cout << id;
prev = id;
}
cout << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |