BEAUTIFUL STRINGS WA help:)

http://www.codechef.com/problems/WICQ8 question link and here is my code

#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include <string>   
#include <algorithm>
using namespace std;
int t,len,i,parentalpha[26],alphavalue,tp=26;
long long ans=0;
string A,B;

int main()
{

scanf("%d\n",&t);
while(t--)
{
    for(i=0;i<26;i++)
{
parentalpha[i]=0;
 }
    std::string str;
    std::getline(cin, str);
    std::transform(str.begin(), str.end(), str.begin(), ::tolower);
    cout<<str<<"\n";
   len=str.length();
   for(i=0;i<len;i++)
  {
   if(int(str[i])>=97&&int(str[i])<=122)   
 {
alphavalue=(str[i])-97;
parentalpha[alphavalue]+=1;
}
}
for(i=0;i<26;i++)
{
 printf("%d ",parentalpha[i]);
 }
     cout<<"\n";
     std::sort(parentalpha, parentalpha + 26);
     for(i=0;i<26;i++)
{
printf("%d ",parentalpha[i]);
}
   cout<<"\n";
   for(i=25;i>=0;i--)
{
 ans=ans+(long long)(parentalpha[i]*tp);
 tp--;
}
  printf("%lld\n",ans);
}

return 0;
  }

dont know what i am doing wrong see the second test case :—
Good luck in the Facebook Hacker Cup this year!
my program gives values of e=4 but it should be 3 moreover the output for 2nd case onward are -ve could u help guys!!!
EDIT::: my updated code with the the mistakes i was doing removed but still i get WA here http://www.codechef.com/viewsolution/2401186 CODE with test cases ::::: http://ideone.com/bvBK5U
Still WA :frowning: think cases or test file is broken

I don’t know what they have done with the official tests here. Its in the Peer section, so you can expect flaws as it is not set and tested by the official Codechef team of setters and testers.

https://gist.github.com/bugkill3r/5481693 Here was my solution which gives WA here. (after removing the Case # stuff)

Go to this link https://www.facebook.com/hackercup/problems.php?round=185564241586420 and then go the problem Beautiful Strings, then download the sample input file and run your program with that input and see what output it produces.

i think ur answer does not satisfies the test cases also except the 1st one that is what happens to my code also :frowning: ie test cases with spaces are the one giving wrong ans

what? you can check my code. its giving right answer for the test cases mentioned there.

ok now i corrected my code an it was illy mistake in while loop where i did not initialize t=26 and ans=0
after that i took input file from net and run them over my code and check it with the outputs of some of the available codes over the web and they all matched still i am getting WA here :frowning:

its giving WA for 2nd case onward http://ideone.com/27NDLx where as here is my code giving right answer still rejected here http://ideone.com/bvBK5U

Its a very easy question but I don’t know why I am getting WA all the time, I am pretty sure that the testfile is broken. Here is a list of my submissions http://www.codechef.com/status/WICQ8,v_akshay

same with me its easy still i am getting WA here at 0.01 sec:(

It was not giving negative answers locally on my machine. However, I have fixed the issue. http://ideone.com/HTkPoQ

Something wrong with the test file, confirmed. http://ideone.com/Kyv42W