Advertisement
Farjana_akter

Untitled

Aug 2nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. freopen("in.txt","r",stdin);
  8. freopen("out.txt","w",stdout);
  9. set<string>s;
  10. string c,ss;
  11. char sr[100];
  12. int a,j;
  13. // cout<<"sr "<<sr<<endl;
  14. getline(cin,c);
  15.  
  16. j=0;
  17. cout<<c<<endl;
  18. // cout<<"sr "<<sr<<endl;
  19. for(int i=0;i<c.length();i++)
  20. {
  21. //sr[j++]=c[i];
  22. //ss.push_back(c[i]);
  23. if(c[i]==' '||i==c.length()-1)
  24. {
  25. if(i==c.length()-1)
  26. ss.push_back(c[i]);
  27. cout<<ss<<endl;
  28. s.insert(ss);
  29. ss.clear();
  30. j=0;
  31. while(c[i]==' ')
  32. i++;
  33. }
  34. // cout<<"c[i] "<<c[i]<<endl;
  35. // sr[j++]=c[i];
  36. ss.push_back(c[i]);
  37.  
  38. // cout<<sr<<endl;
  39. }
  40. cout<<s.size()<<endl;
  41.  
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement