Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define roflan ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- #define ld long double
- #define int long long
- using namespace std;
- signed main(){
- roflan;
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- string s;
- map <char, int> mp;
- while (cin >> s){
- for (auto now : s){
- mp[now]++;
- }
- }
- int mx = -1;
- for (auto now : mp){
- mx = max(mx, now.second);
- }
- int n = mx, m = mp.size();
- vector <vector <char>> a(n, vector <char> (m, ' '));
- auto it = mp.begin();
- for (int j = 0; j < m; j++){
- int ct = mp[it->first];
- for (int i = n - 1; ct && i >= 0; i--, ct--){
- a[i][j] = '#';
- }
- it++;
- }
- for (int i = 0; i < n; i++){
- for (int j = 0; j < m; j++){
- cout << a[i][j];
- }
- cout << '\n';
- }
- for (auto now : mp) cout << now.first;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement