Answer:
#include <iostream>
using namespace std;
int main()
{
string s;
cin>>s; //reading string
int i,j;
bool has_dups=false;
int n= s.length();
for(i=0;i<n;i++) //to check for duplicate characters
{
for(j=0;j<n;j++)
{
if(j!=i && s[i]==s[j]) //to check if it is matched with itself
{
has_dups=true; //if true no need to check others
break;
}
}
}
cout<<has_dups;
return 0;
}
OUTPUT :
California
1
Explanation:
Above program finds if a character repeat itself in the string entered by user.