CPP iterator, trapped in an endless loop when using while?

-sharpinclude <iostream>
-sharpinclude <string>
using namespace std;

int main() {
    string s("some string");
    if (s.begin() != s.end()) {
        auto it = s.begin();
        while (it != s.end() && !isspace(*it))
            *it = toupper(*it);
            itPP;
        cout << s << endl;
    }
    return 0;
}

when learning the cPPprimer iterator section, the requirement is to capitalize all the string s in the above program. The for loop is used in the book. I tried to use while, but the compilation passed. The execution does not show the result, ctrl+D does not react, and can only be forced to end by ctrl+Z or ctrl+C.
I would like to ask if there is a syntax error in my program, or whether the iteration does not support while
Thank you

CPP
Mar.20,2021

-sharpinclude <iostream>
-sharpinclude <string>
using namespace std;

int main() {
    string s("some string");
    if (s.begin() != s.end()) {
        auto it = s.begin();
        while (it != s.end()) {
            *it = toupper(*it);
            itPP;
        }
        cout << s << endl;
    }
    return 0;
}

corrected by the prompt of @ zhenguoli in the comment area

Menu