Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int countE(const string &s) {
- int count = 0;
- for (unsigned int i = 0; i < s.size(); i++) {
- if (s.at(i) == 'e') count++;
- }
- return count;
- }
- int main() {
- vector<string> v = { (string) "aed", (string) "i have a pen", (string) "eeefff" };
- for (string &s: v) {
- cout << s << " " << countE(s) << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement