language: C (gcc-4.7.2)
date: 950 days 21 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>
 
int main(){
    char *p, *start, *result, number[99] = "1", temp[99];
 
    while(1){ /* loop forever */
        puts(number);
        fflush(stdout);
 
        result = temp; /* we'll be incrementing this pointer as we write */
        p = number;    /* we'll be incrementing this pointer as we read */
 
        while(*p){ /* loop till end of string */
            start = p; /* keep track of where we started */
 
            while(*p == *start) /* find all occurrences of this character */
                p++;
 
            *result++ = '0' + p - start; /* write the count of characters, */
            *result++ = *start;          /* the character just counted, */
            *result   = 0;               /* and a terminating null */
        }
 
        strcpy(number, temp); /* copy the result back to our working buffer */
    }
}
prog.c: In function ‘main’:
prog.c:24: warning: implicit declaration of function ‘strcpy’
prog.c:24: warning: incompatible implicit declaration of built-in function ‘strcpy’
  • upload with new input
  • result: Runtime error     time: 0s    memory: 1720 kB     signal: 11 (SIGSEGV)

    1
    11
    21
    1211
    111221
    312211
    13112221
    1113213211
    31131211131221
    13211311123113112211
    11131221133112132113212221
    3113112221232112111312211312113211
    1321132132111213122112311311222113111221131221
    11131221131211131231121113112221121321132132211331222113112211
    311311222113111231131112132112311321322112111312211312111322212311322113212221