Kodewick
Start learning →
Starter←→0 / 60

Fruit basket

#048StarterAlgorithms2 min

The fruit basket has apples, pears, plums… and basket holds one word per fruit. Write apples(basket) and use count to find how many are "apple" (capitals must match).

Examples
apples({"apple", "pear", "apple", "plum"})→2
apples({})→0
The functionint apples(const vector<string> &basket)
main.cpp
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int apples(const vector<string> &basket) {
    // your code here: count "apple" with count
    return 0;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.