1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| #include <bits/stdc++.h> #define fastio ios_base::sync_with_stdio(false), cin.tie(nullptr) using namespace std;
int main(){ fastio; map <char, vector<int>> mp; mp['c'] = {0, 1, 1, 1, 0, 0, 1, 1, 1, 1}; mp['d'] = {0, 1, 1, 1, 0, 0, 1, 1, 1, 0}; mp['e'] = {0, 1, 1, 1, 0, 0, 1, 1, 0, 0}; mp['f'] = {0, 1, 1, 1, 0, 0, 1, 0, 0, 0}; mp['g'] = {0, 1, 1, 1, 0, 0, 0, 0, 0, 0}; mp['a'] = {0, 1, 1, 0, 0, 0, 0, 0, 0, 0}; mp['b'] = {0, 1, 0, 0, 0, 0, 0, 0, 0, 0}; mp['C'] = {0, 0, 1, 0, 0, 0, 0, 0, 0, 0}; mp['D'] = {1, 1, 1, 1, 0, 0, 1, 1, 1, 0}; mp['E'] = {1, 1, 1, 1, 0, 0, 1, 1, 0, 0}; mp['F'] = {1, 1, 1, 1, 0, 0, 1, 0, 0, 0}; mp['G'] = {1, 1, 1, 1, 0, 0, 0, 0, 0, 0}; mp['A'] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; mp['B'] = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; int t; string s; bool vis[11]; int cnt[11]; cin >> t; cin.ignore(); while(t--){ getline(cin, s); memset(vis, 0, sizeof(vis)); memset(cnt, 0, sizeof(cnt)); for(int i = 0; i < s.length(); ++i){ for(int j = 0; j < 10; ++j){ if(mp[s[i]][j]){ if(vis[j]) continue; else { ++cnt[j]; vis[j] = true; } } else vis[j] = false; } } for(int i = 0; i < 10; ++i){ cout << cnt[i] << " "; } cout << "\n"; } return 0; }
|