Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char a[10001],cuv[100001][101],*p,separator[]=" .,;:!?\"'-*(){}[]&=_+/";
- cin.get(a,10001);
- p=a;
- p=strtok(p,separator);
- int nr=0;
- while(p)
- strcpy(cuv[++nr],p),p=strtok(NULL,separator);
- for(int i=1;i<nr;++i)
- for(int j=i+1;j<=nr;++j)
- if(strcmp(cuv[i],cuv[j])>0)
- swap(cuv[i],cuv[j]);
- int i=1;
- while(i<=nr)
- {
- int frecv=1;
- cout<<cuv[i];
- while(i+frecv<=nr&&strcmp(cuv[i],cuv[i+frecv])==0)
- ++frecv;
- cout<<' '<<frecv<<'\n';
- i+=frecv;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement