#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <numeric>
#define int long long
#define ff first
#define ss second
using namespace std;
void solve() {
vector<int> trans(10);
int temp;
vector<int> kak = {2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9};
vector<int> cnt = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4};
for(int i = 1; i < 10; i++) {
cin >> temp;
trans[temp] = i;
}
string s;
cin >> s;
for(int i = 0; i < s.size(); i++) {
if(i != 0 && kak[s[i]-'a'] == kak[s[i - 1]-'a']) cout << '#';
for(int j = 0; j < cnt[s[i] - 'a']; j++) cout << trans[kak[s[i] - 'a']];
}
cout << "\n";
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |