cin >> word;
cout << word.length();
[suppose that the string "I am" was input by the user.]
Now, when I use the code word.length(), the output turns out to be 1 instead of 4. I am assuming that once the first space in "I am" is reached, the function stops counting ahead and as a result the length of the string is returned to be 1 instead of 4.
Is there a way to make the system return the full length of the input string?