• Source
    1. #include<stdio.h>
    2. #include<iostream>
    3. #include<set>
    4.  
    5. using namespace std;
    6.  
    7. set<string>st;
    8.  
    9. int main()
    10. {
    11. char ch;
    12.  
    13. string s="";
    14.  
    15. set<string> :: iterator it;
    16.  
    17. while(scanf("%c",&ch)!=EOF)
    18. {
    19. if(isalpha(ch))
    20. {
    21. s+=tolower(ch);
    22. }
    23. else if(s!="")
    24. {
    25. st.insert(s);
    26. s="";
    27. }
    28. }
    29.  
    30. for(it=st.begin();it!=st.end();it++)
    31. {
    32. cout<<*it<<endl;
    33. }
    34.  
    35. return 0;
    36. }
    37.