Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits\stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- scanf("%d", &t);
- while(t--)
- {
- string s;
- cin >> s;
- int freq[26], i, c1 = 0, c2 = 0;
- for(i = 0; i < 26; i++) freq[i] = 0;
- for(i = 0; i < s.length(); i++) freq[s[i] - 'a']++;
- for(i = 0; i < 26; i++)
- {
- if(freq[i] == 1) c1++;
- else if(freq[i] > 1) c2++;
- }
- printf("%d\n", c2 + (c1/2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement