Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int numSpaces(string s) {
- int ns = 0;
- if (s.empty())
- return 0;
- ns = numSpaces(s.substr(1, -1));
- if (s[0] == ' ')
- ns++;
- return ns;
- }
- void main() {
- // cout << pow2(0) << endl;
- cout << numSpaces("Welcome Home Baby.") << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement