fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. size_t f(std::string const str, std::string const srch)
  5. {
  6. //std::size_t t;
  7. //std::string str(_str);
  8. return str.rfind(srch);
  9. }
  10.  
  11. int main() {
  12. // your code goes here
  13. size_t t = f("Hello how are are you", "you");
  14. if(t == std::string::npos)
  15. {
  16. cout << "Not found";
  17. }
  18. else
  19. cout << "Found @ " << t;
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Found @ 18