-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.13.cpp
More file actions
30 lines (27 loc) · 749 Bytes
/
10.13.cpp
File metadata and controls
30 lines (27 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using std::partition;
using std::string;
using std::vector;
using std::cin;
using std::cout;
using std::endl;
bool hasMoreThanFive(const string &s) {
return s.size() >= 5;
}
int main() {
vector<string> words;
for (string temp; cin >> temp; words.push_back(temp)) ;
vector<string>::const_iterator badStart = partition(words.begin(), words.end(), hasMoreThanFive);
cout << "Good elements:\n";
for (vector<string>::const_iterator iter = words.cbegin(); iter != badStart; ++iter) {
cout << *iter << '\n';
}
cout << "\nBad elements:\n";
for (vector<string>::const_iterator iter = badStart; iter != words.cend(); ++iter) {
cout << *iter << '\n';
}
return 0;
}