

我的代码出现问题,本题希望可以得到大家的指导,谢谢你的帮助!
供参考:
#include <stdio.h>
#include <string.h>
int main()
{
int len, cnt, i, j;
char str[1001] = { 0 };
gets(str);
for (i = 0, cnt = 0, len = strlen(str); i <= len; i++)
{
if (str[i] == '6')
cnt++;
else{
if (cnt > 9)
printf("27");
else if (cnt > 3)
printf("9");
else{
for(j = 0;j < cnt; j++)
printf("6");
}
cnt = 0;
if (str[i])
printf("%c", str[i]);
}
}
return 0;
}