Advertisement
Mlack

909. Количество слов

Dec 29th, 2012
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. //this zadacha from e-olimp
  2. //more on e-olimp.com
  3.  
  4. #include<iostream>
  5. #include<string>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     string stroka;
  12.     getline(cin,stroka);
  13.     int ras = stroka.length();
  14.     int sch=0;
  15.     for (int i = 0; i < ras; i++)
  16.     {
  17.         if (stroka[i] == ' ') { sch++; }
  18.     }
  19.     cout<<sch+1<<endl;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement