githubNonFunziona/2-4-b.spp

69 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-12-05 10:57:14 +00:00
#include <iostream>
#include <string>
int main()
{
std::string clovo;
std::string a;
std::cin >> clovo;
a.push_back(clovo[0]);
for (size_t i = 1; i != clovo.size(); ++i) {
char c = clovo[i];
switch (c) {
case 'b':
case 'f':
case 'p':
case 'v':
c = '1';
if (a.back() != c) {
a.push_back(c);
}
break;
case 'c':
case 'g':
case 'j':
case 'k':
case 'q':
case 's':
case 'x':
case 'z':
c = '2';
if (a.back() != c) {
a.push_back(c);
}
break;
case 'd':
case 't':
c = '3';
if (a.back() != c) {
a.push_back(c);
}
break;
case 'l':
c = '4';
if (a.back() != c) {
a.push_back(c);
}
break;
case 'm':
case 'n':
c = '5';
if (a.back() != c) {
a.push_back(c);
}
break;
case 'r':
c = '6';
if (a.back() != c) {
a.push_back(c);
}
break;
}
}
while (a.size() < 4) {
a.push_back('0');
}
a.resize(4);
std::cout << a;
}