#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<string> svec;
string word;
while (cin >> word) {
svec.push_back(word);
}
string::size_type sz = 4;
auto cnt = count_if(svec.begin(), svec.end(),
[sz](const string &s){return s.size()>sz;});
cout << cnt << " words with length greater than " << sz << endl;
return 0;
}
STL count_if() with lambda expression
最新推荐文章于 2023-08-21 10:29:06 发布