-
Notifications
You must be signed in to change notification settings - Fork 1
/
buy1get1.c
50 lines (42 loc) · 1.4 KB
/
buy1get1.c
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<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
char s[210]={0};
scanf("%s",&s);
int i=0,k=0;
int val[125]={0},count=0;
for(i=0;i<200&&s[i]!=0;i++)
{
k=s[i];
val[k]++;
}
for(i=65;i<=90;i++)
{
if(val[i]==1)
count++;
else
{
if(val[i]%2==1)
count++;
count+=(val[i]/2);
}
}
for(i=97;i<=122;i++)
{
if(val[i]==1)
count++;
else
{
if(val[i]%2==1)
count++;
count+=(val[i]/2);
}
}
printf("%d\n",count);
}
return 0;
}