Advertisement
juyana

uva 10391 Compound Words

Feb 25th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string s,c;
  8. vector<string>v1;
  9. map<string,int>mp;
  10. while(cin>>s){
  11. v1.push_back(s);
  12. mp[s]++;
  13.  
  14. }
  15. for(long int i=0;i<v1.size();i++)
  16. {
  17. for(long int j=0;j<v1.size();j++)
  18. {
  19. c= v1[i]+v1[j];
  20. if(mp[c]!=0) {
  21. cout<<c<<endl;
  22. mp[c]=0;
  23. }
  24. }
  25.  
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement