17413번

seuls2·2023년 2월 24일

BOJ

목록 보기
6/55

17413

#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

map<string, int> m;

void solution(vector<string> v) {
	for (int i = 0; i < v.size(); i++) {
		int start = v[i].find('.') + 1;
		string str = v[i].substr(start, v[i].length());
		m[str]++;
	}

	for (auto str : m) {
		cout << str.first << " " << str.second << endl;
	}
}

int main() {
	int n;
	vector<string> v;
	cin >> n;
	cin.ignore();
	for (int i = 0; i < n; i++) {
		string input;
		getline(cin, input);
		v.push_back(input);
	}
	solution(v);
}
profile
공부 기록용 ( ᵕ·̮ᵕ )♩

0개의 댓글