题解 | 字符串最后一个单词的长度
字符串最后一个单词的长度
https://www.nowcoder.com/practice/8c949ea5f36f422594b306a2300315da
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string input;
vector<string>arr; //定义一个向量容器,用来存储字符串
while (cin >> input) { //
arr.push_back(input); //将读到的字符串添加到arr的末尾
}
cout << arr[arr.size() -1].length() << endl; //读取字符串的最后一个的长度
return 0;
}
// 64 位输出请用 printf("%lld")


