Skip to content

Instantly share code, notes, and snippets.

@be5invis
Created November 25, 2010 11:48
Show Gist options
  • Save be5invis/715262 to your computer and use it in GitHub Desktop.
Save be5invis/715262 to your computer and use it in GitHub Desktop.
An answer for a (fake)loli.
#define digit(p) ('0' <= *(p) && *(p) <= '9')
char* a[1000];
int n = 0;
void fetch(char* p){
while(*p && !digit(p)) p++;
if(*p){
char* start = p;
while(*p && digit(p)) p++;
a[n] = start; n++;
if(*p) *p = 0, fetch(++p);
}
}
int main(){
char* s;
gets(s), fetch(s);
for(int i = 0; i < n; i ++) printf("%s\n", a[i])
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment