Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int CountStr(string s) {
- int count = 0;
- for (int i = s.size() - 1; i > 0; i--)
- {
- if (s[i] == ' ')
- break;
- count++;
- }
- return count;
- }
- int main() {
- setlocale(LC_CTYPE, "");
- string str = "qwerty+2345+g kj ; lrdf";
- cout << CountStr(str);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment