1
11
21
1211
111221
312211
13112221
1113213211
char* get_next_line(char* line)
{
char next_line[4096];
int next_line_ndx = 0;
char letter = line[0];
int num_letters = 0;
for (int i = 0; i < strlen(line); ++i)
{
if (letter != line[i+1])
{
next_line[next_line_ndx] = num_letters + '0';
next_line_ndx++;
next_line[next_line_ndx] = letter;
next_line_ndx++;
next_line[next_line_ndx] = 0;
letter = line[i+1];
num_letters = 0;
}
else
{
num_letters++;
}
}
return next_line;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment