#include <stdio.h> #include <string.h> int spr(char *); void pisz(int); /*********************/ int main(void){ \x09char buf[12]; \x09int n; \x09while(gets(buf)!=NULL){ \x09\x09if(n=spr(buf)) \x09\x09pisz(n); \x09\x09else puts("Miss..."); \x09} \x09 \x09return 0; } /**********************/ int spr(char *buf){ \x09int i=1; \x09int dl=(strlen(buf)+1)/2; \x09char c1=buf[0]; \x09char c2; \x09if(c1!='1') \x09return 0; \x09\x09for(;i<dl;i++){ \x09\x09c2=buf[2*i]; \x09\x09\x09if((c2-1)!=c1) \x09\x09\x09return 0; \x09\x09c1=c2; \x09\x09} \x09return dl; } void pisz(int n){ \x09char napis[]="2 3 4 5 6 Do it!!"; \x09strcpy(napis,napis+(n-1)*2), \x09puts(napis); }
Note that non-ascii characters in the above source code will be escaped (such as \x9f).