Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

-3 bytes
Source Link

C (gcc), 189186 bytes

m,n;f(m){char*s;scanf("%m[^?]",&s);for(printf("How to%s in %d easy step%s!\n\n",strncpymemcpy(s+=2++s,"Do" Do not",67)+6+7,m=++n,"s"+!(n=time()%10));n--;printf("Step %d -%s.\n",m-n,(n||(*(s+=7)^=321[s+=7]^=32),s)));}

Try it online! Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space m- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

-31 bytes thanks to ErikF

-2 bytes by removing s in %m[^?]s and by removing space in "Do not "

-2 bytes thanks to ceilingcat

-1 byte thanks to ErikF

C (gcc), 189 bytes

m,n;f(){char*s;scanf("%m[^?]",&s);for(printf("How to%s in %d easy step%s!\n\n",strncpy(s+=2,"Do not",6)+6,m=++n,"s"+!(n=time()%10));n--;printf("Step %d -%s.\n",m-n,(n||(*(s+=7)^=32),s)));}

Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space m- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

-31 bytes thanks to ErikF

-2 bytes by removing s in %m[^?]s and by removing space in "Do not "

C (gcc), 186 bytes

n;f(m){char*s;scanf("%m[^?]",&s);for(printf("How to%s in %d easy step%s!\n\n",memcpy(++s," Do not",7)+7,m=++n,"s"+!(n=time()%10));n--;printf("Step %d -%s.\n",m-n,(n||(1[s+=7]^=32),s)));}

Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space m- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

-31 bytes thanks to ErikF

-2 bytes by removing s in %m[^?]s and by removing space in "Do not "

-2 bytes thanks to ceilingcat

-1 byte thanks to ErikF

-33 bytes
Source Link

C (gcc), 222189 bytes

char a[99]="Do not ";b;m;n;mainm,n;f(){lseekchar*s;scanf(0,9"%m[^?]",1);a[strlen(gets(a+7)&s)+6]=0;n=m=time;for(0)%10;printfprintf("How to%s in %d easy step%s!\n\n",strncpy(b=as+=2,"Do not",6)+6,++mm=++n,"s"+!n);while(n>0n=time()l:printf%10));n--;printf("Step %d - %s.\n",m-n--,b);b+=7;a[7]^=32;if(!nn||(*(s+=7)goto l;^=32),s)));}

Try it online! Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space m- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

-31 bytes thanks to ErikF

-2 bytes by removing s in %m[^?]s and by removing space in "Do not "

C (gcc), 222 bytes

char a[99]="Do not ";b;m;n;main(){lseek(0,9,1);a[strlen(gets(a+7))+6]=0;n=m=time(0)%10;printf("How to%s in %d easy step%s!\n\n",(b=a)+6,++m,"s"+!n);while(n>0)l:printf("Step %d - %s.\n",m-n--,b);b+=7;a[7]^=32;if(!n)goto l;}

Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space m- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

C (gcc), 189 bytes

m,n;f(){char*s;scanf("%m[^?]",&s);for(printf("How to%s in %d easy step%s!\n\n",strncpy(s+=2,"Do not",6)+6,m=++n,"s"+!(n=time()%10));n--;printf("Step %d - %s.\n",m-n,(n||(*(s+=7)^=32),s)));}

Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space m- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

-31 bytes thanks to ErikF

-2 bytes by removing s in %m[^?]s and by removing space in "Do not "

-1 byte
Source Link

C (gcc), 223222 bytes

char a[99]="Do not ";b;m;n;main(){lseek(0,9,1);a[strlen(gets(a+7))+6]=0;n=m=time(0)%10;printf("How to%s in %d easy step%s!\n\n",(b=a)+6,++m,"s"+!n);while(n>0)l:printf("Step %d - %s.\n",m-n--,b);b+=7;a[7]^=32;if(n+1!n)goto l;}

Try it online! Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a spacem- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

C (gcc), 223 bytes

char a[99]="Do not ";b;m;n;main(){lseek(0,9,1);a[strlen(gets(a+7))+6]=0;n=m=time(0)%10;printf("How to%s in %d easy step%s!\n\n",(b=a)+6,++m,"s"+!n);while(n>0)l:printf("Step %d - %s.\n",m-n--,b);b+=7;a[7]^=32;if(n+1)goto l;}

Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a space

-3 bytes thanks to Arnauld

C (gcc), 222 bytes

char a[99]="Do not ";b;m;n;main(){lseek(0,9,1);a[strlen(gets(a+7))+6]=0;n=m=time(0)%10;printf("How to%s in %d easy step%s!\n\n",(b=a)+6,++m,"s"+!n);while(n>0)l:printf("Step %d - %s.\n",m-n--,b);b+=7;a[7]^=32;if(!n)goto l;}

Try it online!

+14 bytes due to removing the last s in ...steps! when n=1

-2 bytes by using lseek

-2 bytes by changing conditions

-1 byte by removing a spacem- --nm-n--

-3 bytes thanks to Arnauld

-1 byte by changing the last condition from n+1 to !n

-3 bytes
Source Link
Loading
+2 bytes -1 byte
Source Link
Loading
-6 bytes + remove of the non s-removing code
Source Link
Loading
second `\n` added after `...steps!`
Source Link
Loading
Source Link
Loading

AltStyle によって変換されたページ (->オリジナル) /