Untitled
#include<bits/stdc++.h> using namespace std; const int N = 105; map<char, int> mp; void fun(string s) { for(int i = 0; i < s.size(); i++) { mp[s[i]]++; } } int main () { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; std::vector<string> v[N]; for(int i = 0; i < n; i++) { string s, t; cin >> s >> t; v[i].push_back(s); v[i].push_back(t); } set<string> se1, se2, se3; for(int i = 0; i < n; i++) { for(int j = i + 1; j < n; j++) { for(int k = j + 1; k < n; k++) { for(auto it : v[i]) { for(auto it1 : v[j]) { for(auto it2 : v[k]) { se1.insert(it); se2.insert(it1); se3.insert(it2); } } } } } } for(auto it : se1) { fun(it); } for(auto it : se1 ) { fun(it); } for(auto it : se2) { fun(it); } for(char ch = 'a'; ch <= 'z'; ch++) { cout << mp[ch] << "\n"; } return 0; }
Leave a Comment