Vla_DOS

Untitled

Jun 20th, 2022
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int CountStr(string s) {
  6.     int count = 0;
  7.     for (int i = s.size() - 1; i > 0; i--)
  8.     {
  9.         if (s[i] == ' ')
  10.             break;
  11.         count++;
  12.     }
  13.     return count;
  14. }
  15. int main() {
  16.     setlocale(LC_CTYPE, "");
  17.     string str = "qwerty+2345+g kj ; lrdf";
  18.     cout << CountStr(str);
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment