c++ check substring
#include <iostream>
#include <string>
using namespace std;
int main() {
string str = "Hello, world!";
string sub = "world";
size_t found = str.find(sub);
if (found != string::npos) {
cout << "Subtring found at position: " << found << endl;
} else {
cout << "Substring not found" << endl;
}
return 0;
}