xT30x

Untitled

Nov 27th, 2022
1,156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 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. ll ap;
  8. string ad(string x, map<char, string> &z1)
  9. {
  10.     stringstream a(x);
  11.     char h;
  12.     a >> h;
  13.     x = string(1, h);
  14.     ll w;
  15.     a >> w;
  16.     ap = w;
  17.     for (auto &cl : z1)
  18.     {
  19.         cl.second += string(w - 1, cl.second.at(cl.second.size() - 1));
  20.     }
  21.     return x;
  22. }
  23. int main()
  24. {
  25.     string a1, a2;
  26.     a1 = "FDBgea";
  27.     a2 = "GECAfdcb";
  28.     ll n;
  29.     cin >> n;
  30.     cin.ignore();
  31.     string x;
  32.     getline(cin, x);
  33.     stringstream ss(x);
  34.  
  35.     map<char, string> z1;
  36.     ll i = 0;
  37.     for (auto cl : a1)
  38.     {
  39.         z1[cl] = string(n * 2 - 1, '-');
  40.     }
  41.     for (auto cl : a2)
  42.     {
  43.         z1[cl] = string(n * 2 - 1, ' ');
  44.     }
  45.     while (n-- > 0)
  46.     {
  47.         ss >> x;
  48.         if (x.size() == 1)
  49.         {
  50.             z1[x.at(0)].at(i) = '*';
  51.             i += 2;
  52.         }
  53.         else
  54.         {
  55.             x = ad(x, z1);
  56.             while (ap-- > 0)
  57.             {
  58.                 z1[x.at(0)].at(i) = '*';
  59.                 i++;
  60.             }
  61.             i++;
  62.         }
  63.     }
  64.     x = "GFEDCBAgfedcba";
  65.     for (auto cl : x)
  66.     {
  67.         cout << cl << ": " << z1[cl] << endl;
  68.     }
  69.  
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment