10.20
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int larger(vector<string> &words, vector<string>::size_type sz)
{
int cnt = count_if(words.cbegin(), words.cend(),
[sz](const string &s) -> bool { return s.size() > sz; });
return cnt;
}
int main()
{
vector<string> words;
string word;
while (cin >> word) {
words.push_back(word);
}
auto cnt = larger(words, 4);
cout << cnt << endl;
return 0;
}
10.21
#include <iostream>
#include <algorithm>
using namespace std;
void dec(int para)
{
int i = para;
auto f = [&i]() -> bool {
if ( i > 0 ) {
--i;
return false;
} else {
return true;
}
};
for (int j = 0; j < para + 1; j++)
cout << f() << " ";
cou