#include <bits/stdc++.h>
using namespace std;
string l[]={"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> mp;
string s;
int main()
{
int a;
for (int i=0;i<9;i++)
{
cin>>a;
mp[a]=i+1;
}
cin>>s;
for (int i=0;i<s.length();i++)
{if (i&&l[s[i]-'a'][0]==l[s[i-1]-'a'][0])
cout <<"#";
for (int g=0;g<l[s[i]-'a'].length();g++)
cout <<mp[l[s[i]-'a'][g]-'0'];}
return 0;
}
Compilation message
mobitel.cpp: In function 'int main()':
mobitel.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
16 | for (int i=0;i<s.length();i++)
| ~^~~~~~~~~~~
mobitel.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
19 | for (int g=0;g<l[s[i]-'a'].length();g++)
| ~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |