杭电OJ 1020为什么错啊该怎么解决

杭电OJ 1020为什么错啊
题目见这里http://acm.hdu.edu.cn/showproblem.php?pid=1020
我的代码编译已经通过
#include<stdio.h>
void main()
{
int line;
int str;
int count[26];
int character[26];
int i,j;
int find;
scanf("%d", &line);
getchar();
do
{
for (i = 0; i < 26; i++)
{
count[i] = 0;
character[i] = -1;
}
i = 0;
while ((str = getchar()) != '\n')
{
find = 0;
j = 0;
while (j<i)
{
if (character[j] == str)
{
find = 1;
break;
}
j++;
}

if (find == 1)
count[j]++;
else
{
character[i] = str;
count[i]++;
i++;
}
}
for (j = 0; j < i; j++)
{
if (count[j] == 1)
printf("%c", character[j]);
if (count[j]>1)
printf("%d%c", count[j], character[j]);
}
line--;
printf("\n");
} while (line);
}

------解决方案--------------------
这道题目的意思是要你把相同的字母序列变为数字加字母,比如AABAA,你应该输出2AB2A,而不是4AB。
------解决方案--------------------
引用:
Quote: 引用:

这道题目的意思是要你把相同的字母序列变为数字加字母,比如AABAA,你应该输出2AB2A,而不是4AB。

按你说的我修改了代码通过了,话说题目里哪里说是这样的输出的呀?


看这句:
Each sub-string containing k same characters should be encoded to "kX" where "X" is the only character in this sub-string.
每一个截取的字符串包含k个一样的字符,把他替换成kX,而这里X是这段截取字符串中唯一一种字符。
所以要求2A,就必须是AA,4A就一定是AAAA。