Warm up


This is a very easy warm-up problem. You are given a string. Your task is to determine whether number of occurrences of some character in the string is equal to the sum of the numbers of occurrences of other characters in the string. Input The first line of the input contains an integer T denoting the number of test cases. Each of the next T lines contains one string S consisting of lowercase latin letters. Output For each test case, output a single line containing ""YES"" if the string satisfies the condition given above or ""NO"" otherwise. Constraints 1 <= T <= 1000 1 <= length of S <= 50 Test Case 1 Input (stdin) 4 acab zzqzqq abc kklkwwww Expected Output YES YES NO YES Test Case 2 Input (stdin) 3 good beauty study Expected Output YES NO NO

Program :

int main()
 char s[200];
 int t,len,arr[26],i,f;
  for(i=0;i<26;i++) arr[i] = 0;
  len = strlen(s);
   arr[s[i] - 'a']++;
  f = 0;
   if(arr[i] == len - arr[i]) { f = 1;break; }
  if(f == 1) printf("YES\n");
  else printf("NO\n");