题解 | 统计单词
#include <bits/stdc++.h> using namespace std; int main(){ string s; queue<int>q; while(cin>>s){ if(s[s.size()-1]=='.'){ q.push(s.size()-1); break; } q.push(s.size()); } while(!q.empty()){ cout<<q.front()<<" "; q.pop(); }cout<<endl; }
用啥都行,练习一下queue