Advertisement
Guest User

stroka17

a guest
Jun 25th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. bool check(string slovo)
  7. {
  8. for (int i=0;i<slovo.size();i++)
  9. {
  10. for (int j=0;j<slovo.size();j++)
  11. {
  12. if (slovo[i]==slovo[j] && i!=j)
  13. {
  14. return 1;
  15. }
  16. }
  17. }
  18. return 0;
  19. }
  20.  
  21. int main()
  22. {
  23. string slovo(""),str;
  24. getline(cin,str);
  25. int m=0;
  26. str+=' ';
  27.  
  28. for (int i=0;i<str.size();i++)
  29. {
  30. if (str[i]!=' ')
  31. {
  32. slovo+=str[i];
  33. }
  34. else
  35. {
  36. if (check(slovo))
  37. {
  38. cout<<slovo<<' ';
  39. m++;
  40. }
  41. slovo.clear();
  42. }
  43. }
  44. if (!m)
  45. cout<<'0';
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement