Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. int numSpaces(string s) {
  2. int ns = 0;
  3. if (s.empty())
  4. return 0;
  5. ns = numSpaces(s.substr(1, -1));
  6. if (s[0] == ' ')
  7. ns++;
  8. return ns;
  9. }
  10.  
  11.  
  12. void main() {
  13. // cout << pow2(0) << endl;
  14. cout << numSpaces("Welcome Home Baby.") << endl;
  15. system("pause");
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement