2814 {
2815 char str[52];
2816 int count = 0;
2817 auto poses = vector(26, vector<int>());
2818 for(int i = 0; i < 52; i++) {
2819 char ch;
2820 cin >> ch;
2821 str[i] = ch;
2822 poses[ch - 'A'].push_back(i);
2823 }
2824 for(auto pos: poses) {
2825 auto um = unordered_map<int, int>();
2826 for(int i = pos[0] + 1; i < pos[1]; i++) {
2827 if(!um.contains(str[i])) {
2828 um.insert(pair(str[i], 1));
2829 } else {
2830 um[str[i]] = 0;
2831 }
2832 }
2833 for(const auto p: um) {
2834 if(p.second == 1) {
2835 count++;
2836 }
2837 }
2838 um = unordered_map<int, int>();
2839 for(int i = pos[1] + 1; i < pos[0] + 52; i++) {
2840 if(!um.contains(str[i % 52])) {
2841 um.insert(pair(str[i % 52], 1));
2842 } else {
2843 um[str[i % 52]] = 0;
2844 }
2845 }
2846 for(const auto p: um) {
2847 if(p.second == 1) {
2848 count++;
2849 }
2850 }
2851 }
2852 cout << count / 4;
2853 return 0;
2854 }