#include#include using namespace std; int main(){ string str = "C++ Programming Language"; string sub_str = "Lang"; int pos = str.rfind(sub_str); cout << pos << endl; // Output: 18 return 0; }
#includeBoth of these examples use the ```#include using namespace std; int main(){ string str = "John Doe"; char ch = 'o'; int pos = str.rfind(ch); cout << pos << endl; // Output: 7 return 0; }