Untitled
unknown
plain_text
a year ago
574 B
7
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;
}Editor is loading...
Leave a Comment