#include(5488)#includeusing namespace std;int jishu(string str) {int n = str.size();cout cout int flag = 0;for (int i = 0; i char a = str[i];if (str[i] != ' ') {flag++;}else flag = 0;}return flag;}int main() {string str = {0};cout //cin >> str;getline(cin,str);int n = jishu(str);cout return 0;} 我已经通过这道算法题! 计算字符串最后一个单词的长度,单词以空格隔开。 https://www.nowcoder.com/questionTerminal/8c949ea5f36f422594b306a2300315da