-
What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string s ("Nobody does like Interview Mania.");
string key ("Nobody");
size_t f;
f = s.rfind(key);
if (f != string::npos)
s.replace (f, key.length(), "Everybody");
cout << s << endl;
return 0;
}
-
- Nobody
- Everybody
- Everybody does like Interview Mania.
- Nobody does like Interview Mania.
- None of these
Correct Option: C
rfind is used to find the characters in the string and replace is used to replace with certain characters.