Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- string s;
- getline(cin, s);
- map<char, int> m;
- for(int i = 0; i < s.size(); i++){
- m[s[i]]++;
- }
- for(map<char, int>::iterator it = m.begin(); it != m.end(); it++){
- cout<<it->first<<' '<<it->second<<endl;
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// map<pair<char, char>, int> m2;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// cout<<"comma+space:"<<endl;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for(int i = 0; i < s.size() - 1; i++){
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// m2[make_pair(s[i], s[i+1])]++;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// for(map<pair<char, char>, int>::iterator it = m2.begin(); it != m2.end(); it++){
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// cout<<it->first.first<<it->first.second<<' '<<it->second<<endl;
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// }
- ///ЗЮЙИВЫЩМЗСЛЙЯЙЫИЖСОКЗОЪЪОНЩЙЦ ЫЗЖЪЗВЙУЬ ЫЗЫЗУЩЧОЗЖСФЧКЧ,ГЗЧМЩРЛЙЛВ
- char space;
- cin>>space;
- for(int i = 0 ; i < s.size() ; i++){
- if(s[i]==' ') s[i]='*';
- if(s[i]==',') s[i]='@';
- if(s[i]==space) s[i]=' ';
- }
- cout<<s<<endl;
- map<char, int> mn;
- for(int i = 0; i < s.size(); i++){
- mn[s[i]]++;
- }
- for(map<char, int>::iterator it = mn.begin(); it != mn.end(); it++){
- cout<<it->first<<' '<<it->second<<endl;
- }
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement