count word c 2b 2b

Solutions on MaxInterview for count word c 2b 2b by the best coders in the world

showing results for - "count word c 2b 2b"
Darryl
01 Feb 2018
1int countWords(string str)
2{
3    // Input: Go Go Ganger
4  	// Output: 3
5    stringstream s(str); 
6    string word; // to store individual words
7    int count = 0;
8    while (s >> word)
9        count++;
10    return count;
11}