Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <string>
- using namespace std;
- #define D(x) cout << #x << " " << x << endl
- int main() {
- int n;
- cin >> n;
- D(n);
- map<string, int> trees;
- for(int i = 0; i < n; ++i) {
- string currTree;
- cin >> currTree;
- trees[currTree] += 1;
- }
- map<string,int>::iterator it;
- for(it = trees.begin(); it != trees.end(); ++it) {
- cout << it -> first << " " << it -> second << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement