Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- set<string>st;
- string s,s1;
- int main()
- {
- stringstream ss;
- int len,i;
- while(cin>>s)
- {
- len = s.size();
- if(s[len-1]=='-')
- {
- s.erase(len-1);
- }
- else
- {
- s+=" ";
- }
- for(i=0;i<len;i++)
- {
- if(s[i]>='A' && s[i]<='Z')
- {
- s[i]+=32;
- }
- else if((s[i]<'a' || s[i]>'z') && s[i]!='-')
- {
- s[i] = ' ';
- }
- }
- ss<<s;
- }
- while(ss>>s1)
- {
- st.insert(s1);
- }
- for(auto it : st)
- {
- printf("%s\n",it.c_str());
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment