find in string c++

C++
if (string1.find(string2) != std::string::npos) {
    std::cout << "found!" << '\n';
}word = 'geeks for geeks'
  
# returns first occurrence of Substring 
result = word.find('geeks') 
print ("Substring 'geeks' found at index:", result ) 
  
result = word.find('for') 
print ("Substring 'for ' found at index:", result ) 
  
# How to use find() 
if (word.find('pawan') != -1): 
    print ("Contains given substring ") 
else: 
    print ("Doesn't contains given substring") 
size_t find (const string& str, size_t pos = 0) const;

Source

Also in C++: