Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define lli long long int
- #define sf scanf
- #define pf printf
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- freopen("C:\\Users\\DELL\\Documents\\input.txt","rt",stdin);
- freopen("C:\\Users\\DELL\\Documents\\output.txt","wt",stdout);
- lli i,l,no,flag=0;
- set<string> s;
- string ch,str;
- while(cin>>ch)
- {
- for(i=0; i<ch.size(); i++)
- {
- //cout<<"j"<<endl;
- flag=0;
- if(ch[i]>='a'&&ch[i]<='z')continue;
- else if(ch[i]>='A'&&ch[i]<='Z') ch[i]+=32;
- else if(ch[i]=='.'||ch[i]=='"')
- {
- ch.erase(ch.begin()+i);
- i--;
- }
- else
- {
- if(i==0)
- {
- s.erase(s.begin());
- i=-1;
- }
- else
- {
- str.append(ch.begin(),ch.begin()+i);
- ch.erase(ch.begin(),ch.begin()+i+1);
- l=str.length();
- if(l==1&&str[0]!=' ')
- {
- s.insert(str);
- }
- else if(l)
- s.insert(str);
- i=-1;
- }
- }
- }
- str.clear();
- l=ch.length();
- if(l==1&&ch[0]!=' ')
- {
- s.insert(ch);
- }
- else if(l)
- s.insert(ch);
- }
- for(set<string>::iterator it=s.begin(); it!=s.end(); it++)
- {
- cout<<*it<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement