Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
574 B
1
Indexable
#include <iostream>
#include <map>
#include <string>

using namespace std;

typedef long long ll;

int main() { // SAPXEP
    freopen("SAPXEP.INP","r",stdin);
    freopen("SAPXEP.OUT","w",stdout);

    string s; map<string, int> mp;
    while(cin >> s){
        mp[s]++;
    }
    for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++){
        for(int i = 0; i < (*it).second; i++) cout << (*it).first << " ";
    }
    for(map<string, int>::iterator it = mp.begin(); it != mp.end(); it++) cout << endl << (*it).first << ':' << (*it).second;

    return 0;
}
Leave a Comment