include iostream using namespace std int main string first second cout

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
using namespace std;
int main() {
string first, second;
cout << "Enter first string: ";
cin >> first;
cout << "Enter second string: ";
cin >> second;
if (first.substr(0, first.length() / 2) == second.substr(0, second.length() / 2)) {
cout << "The first half of the strings are equal" << endl;
} else {
cout << "The first half of the strings are not equal" << endl;
}
return 0;
}