# TOPIC

Wrong error (50%)

#### Lucas Ortega asked 3 years ago

O que estaria causando os 50 % de erro neste código?

``````
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[])
{
int ace, i, j, k, lenght = 0, n, exceed = 1;
scanf ("%d", &n);
char compressed[n][20001], text[n][2001];
for (i = 0; i < n; i++)
{
fflush (stdin);
gets (text[i]);
lenght = strlen (text[i]);
for (j = 0, k = 0; j < lenght; j++)
{
if (text[i][j] == '0' && text[i][j + 1] == '0' && text[i][j + 2] == '0')
{
ace = 2;
exceed = 1;
while (text[i][j + 2] == '0')
{
ace++;
if (ace == 255)
{
compressed[i][k + 1] = (char) ace;
ace = 2;
exceed++;
}
j++;
}
j++;
compressed[i][k] = '#';
compressed[i][k + exceed] = (char) ace;
k += exceed + 1;
continue;
}
if (text[i][j] == ' ' && text[i][j + 1] == ' ' && text[i][j + 2] == ' ')
{
ace = 2;
while (text[i][j + 2] == ' ')
{
ace++;
if (ace == 255)
{
compressed[i][k + 1] = (char) ace;
ace = 2;
exceed++;
}
j++;
}
j++;
compressed[i][k] = '\$';
compressed[i][k + exceed] = (char) ace;
k += exceed + 1;
continue;
}
compressed[i][k] = text[i][j];
k++;
}
printf ("%s\n", compressed[i]);
}
return 0;
}
````````

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.