title: How to find whether the string is a Lapindrome?
body: <p>The following code is giving correct output as given on the codechef problem page: <a href="http://www.codechef.com/problems/LAPIN" rel="nofollow noreferrer">http://www.codechef.com/problems/LAPIN</a>
  but getting wrong answer on submission
  please tell me the possible problem with my code</p>
  
  <p>here is the question</p>
  
  <p>Lapindrome is defined as a string which when split in the middle, gives two halves having the same characters and same frequency of each character. If there are odd number of characters in the string, we ignore the middle character and check for lapindrome. For example gaga is a lapindrome, since the two halves ga and ga have the same characters with same frequency. Also, abccab, rotor and xyzxy are a few examples of lapindromes. Note that abbaab is NOT a lapindrome. The two halves contain the same characters but their frequencies do not match. 
  Your task is simple. Given a string, you need to tell if it is a lapindrome.</p>
  
  <p>Input:</p>
  
  <p>First line of input contains a single integer T, the number of test cases.</p>
  
  <p>Each test is a single line containing a string S composed of only lowercase English alphabet.</p>
  
  <p>Output:</p>
  
  <p>For each test case, output on a separate line: "YES" if the string is a lapindrome and "NO" if it is not.</p>
  
  <p>and here is the code</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  int main()
  {
      int f,t,mid,len;
      char arr[1000];
      int left[125],right[125];
      scanf("%d",&amp;t);
      for(int i=0;i&lt;t;i++)
      {
          f=0;
          scanf("%s",arr);
          memset(left,0,sizeof(left));
          memset(right,0,sizeof(right));
          len=strlen(arr);
          for(int i=0;i&lt;len/2;i++)
              left[arr[i]]++;
          for(int i=(len+1)/2;i&lt;len;i++)
              right[arr[i]]++;
          for(int i=0;i&lt;strlen(arr);i++)
          {
              if(left[arr[i]]!=right[arr[i]])
                  f++;
              break;
          }
          if(f==0)
              printf("YES\n");
          else
              printf("NO\n");
      }
      return 0;
  }
  </code></pre>