Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- bool check(string slovo)
- {
- for (int i=0;i<slovo.size();i++)
- {
- for (int j=0;j<slovo.size();j++)
- {
- if (slovo[i]==slovo[j] && i!=j)
- {
- return 1;
- }
- }
- }
- return 0;
- }
- int main()
- {
- string slovo(""),str;
- getline(cin,str);
- int m=0;
- str+=' ';
- for (int i=0;i<str.size();i++)
- {
- if (str[i]!=' ')
- {
- slovo+=str[i];
- }
- else
- {
- if (check(slovo))
- {
- cout<<slovo<<' ';
- m++;
- }
- slovo.clear();
- }
- }
- if (!m)
- cout<<'0';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement