#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int m;
string str;
vector<int> v(9);
for(int i=0;i<9;i++){
cin>>m;
m--;
v[m]=i+1;
}
cin>>str;
int k=str.length();
int g=0;
for(int i=0;i<k;i++){
//cout<<str[i];
int n=str[i]-'a';
if(n<3){
if(g==3)cout<<'#';
for(int j=n;j>=0;j--)cout<<v[1];
g=3;
}
else if(n<6){
if(g==6)cout<<'#';
for(int j=n;j>=3;j--)cout<<v[2];
g=6;
}
else if(n<9){
if(g==9)cout<<'#';
for(int j=n;j>=6;j--)cout<<v[3];
g=9;
}
else if(n<12){
if(g==12)cout<<'#';
for(int j=n;j>=9;j--)cout<<v[4];
g=12;
}
else if(n<15){
if(g==15)cout<<'#';
for(int j=n;j>=12;j--)cout<<v[5];
g=15;
}
else if(n<19){
if(g==19)cout<<'#';
for(int j=n;j>=15;j--)cout<<v[6];
g=19;
}
else if(n<22){
if(g==22)cout<<'#';
for(int j=n;j>=19;j--)cout<<v[7];
g=22;
}
else if(n<26){
if(g==26)cout<<'#';
for(int j=n;j>=22;j--)cout<<v[8];
g=26;
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |