T3000

Untitled

Sep 28th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. using ll = long long;
  5. using ld = long double;
  6.  
  7. int main()
  8. {
  9.     vector<string> s{"BFPV", "CGJKQSXZ", "DT", "L", "MN", "R"};
  10.     map<char, char> z1;
  11.     for (int i = 0; i < 6; i++)
  12.     {
  13.         for (auto cl : s.at(i))
  14.         {
  15.             z1[cl] = to_string(i + 1).at(0);
  16.         }
  17.     }
  18.     string a;
  19.     while (cin >> a)
  20.     {
  21.         char tipe = z1[a.at(0)];
  22.         cout << tipe;
  23.         for (int i = 0; i < a.size(); i++)
  24.         {
  25.             if (z1[a.at(i)] != tipe)
  26.             {
  27.                 tipe = z1[a.at(i)];
  28.                 cout << tipe;
  29.             }
  30.         }
  31.         cout << endl;
  32.     }
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment