Advertisement
Guest User

Untitled

a guest
May 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define roflan ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  3. #define ld long double
  4. #define int long long
  5. using namespace std;
  6.  
  7. signed main(){
  8.     roflan;
  9.     freopen("input.txt", "r", stdin);
  10.     freopen("output.txt", "w", stdout);
  11.     string s;
  12.     map <char, int> mp;
  13.     while (cin >> s){
  14.         for (auto now : s){
  15.             mp[now]++;
  16.         }
  17.     }
  18.     int mx = -1;
  19.     for (auto now : mp){
  20.         mx = max(mx, now.second);
  21.     }
  22.     int n = mx, m = mp.size();
  23.     vector <vector <char>> a(n, vector <char> (m, ' '));
  24.     auto it = mp.begin();
  25.     for (int j = 0; j < m; j++){
  26.         int ct = mp[it->first];
  27.         for (int i = n - 1; ct && i >= 0; i--, ct--){
  28.             a[i][j] = '#';
  29.         }
  30.         it++;
  31.     }
  32.     for (int i = 0; i < n; i++){
  33.         for (int j = 0; j < m; j++){
  34.             cout << a[i][j];
  35.         }
  36.         cout << '\n';
  37.     }
  38.     for (auto now : mp) cout << now.first;
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement