fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. string getWord(string&& str, int n )
  7. {
  8. stringstream word;
  9. word << str;
  10. string tmp;
  11.  
  12. while (n--) word >> tmp;
  13. return tmp;
  14. }
  15.  
  16. int main() {
  17.  
  18. auto word = getWord("Hello, how are you?", 3);
  19. cout << word;
  20. // your code goes here
  21. return 0;
  22. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
are