Hi,
Since your question is not elaborative enough I am assuming that you need a solution in which we have to accept only those string in which all character is the same. And the user will be inputting string 2 times. You can change the num of iteration as per your choice. I have made it as 2.
Please find the code below:
#include <iostream>
using namespace std;
bool checkString(string s)
{
int len_string = s.length();
for (int i = 1; i < len_string; i++)
if (s[i] != s[0])
return false;
return true;
}
int main()
{
string s;
for(int i=0;i<2;i++){
cout<<"Enter string "<<endl;
cin>>s;
if (checkString(s))
cout<<"string acceted"<<endl;
else
cout<<"string not acceted"<<endl;
cout<<"\n";
}
return 0;
}
OUTPUT:

I hope it helps.
In case of any query revert back to me.
Have a great day :)
write a C++ to defined language the output should show this answer Enter string aa string...