Skip to main content
Commonmark migration
Source Link

#C 168 ,145,144,141 bytes

C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

Obfuscated

#define F(x)if(scanf(#x+B,&A)>0){printf(#x,&A);continue;} B;A;main(i){for(;i;){B=1;F(\40e%4s)F(\40th%3s)F(\40se%3s)F(\40o%2s)B=2;F(\40tw%1s)F(\40si%1s)B=1;F(\40%4s)i=0;}} 

#C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

Obfuscated

#define F(x)if(scanf(#x+B,&A)>0){printf(#x,&A);continue;} B;A;main(i){for(;i;){B=1;F(\40e%4s)F(\40th%3s)F(\40se%3s)F(\40o%2s)B=2;F(\40tw%1s)F(\40si%1s)B=1;F(\40%4s)i=0;}} 

C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

Obfuscated

#define F(x)if(scanf(#x+B,&A)>0){printf(#x,&A);continue;} B;A;main(i){for(;i;){B=1;F(\40e%4s)F(\40th%3s)F(\40se%3s)F(\40o%2s)B=2;F(\40tw%1s)F(\40si%1s)B=1;F(\40%4s)i=0;}} 
added 199 characters in body
Source Link

#C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

Obfuscated

#define F(x)if(scanf(#x+B,&A)>0){printf(#x,&A);continue;} B;A;main(i){for(;i;){B=1;F(\40e%4s)F(\40th%3s)F(\40se%3s)F(\40o%2s)B=2;F(\40tw%1s)F(\40si%1s)B=1;F(\40%4s)i=0;}} 

#C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

#C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

Obfuscated

#define F(x)if(scanf(#x+B,&A)>0){printf(#x,&A);continue;} B;A;main(i){for(;i;){B=1;F(\40e%4s)F(\40th%3s)F(\40se%3s)F(\40o%2s)B=2;F(\40tw%1s)F(\40si%1s)B=1;F(\40%4s)i=0;}} 
added 654 characters in body
Source Link

#C 168 ,145,144144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

144141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",a;main&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it onlineTry it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

#C 168 ,145,144 bytes

144

b,a;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

#C 168 ,145,144,141 bytes

EDIT: Tried init 'i' to 1 like so

a,b;main(i)

To get rid of leading whitespace,
but it breaks on input starting with three, seven or eight

141

#define s|a%1000== a,i;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b%32<<5*i++)if(i>4|a%100==83 s 138 s 116 s 814 s 662 s 478)a=i=0;} 

Try it online

144

a,i;main(b){for(;~(b=getchar());printf(" %c"+!!i,b),a=a*21+b-100,++i)if(i>4|a==204488|a==5062|a==7466|a==23744|a==21106|a==6740|a==95026)a=i=0;} 

Try it online

168

i,a;main(b){for(;~scanf("%c",&b);printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4|a==1869768058|a==6647407|a==7305076|a==1920298854|a==1702259046|a==7891315|a==1701734766)a=i=0;} 

Try it online!

Ungolfed

i,a;main(b){ for(;~scanf("%c",&b); // for every char of input printf(" %c"+!!i,b), // print whitespace if i==0 , + char a|=b<<8*i++ // add char to a for test ) if( i>4| // three seven eight a==1869768058| // zero a==6647407| // one a==7305076| // two a==1920298854| //four a==1702259046| //five a==7891315| //six a==1701734766 //nine ) a=i=0; //reset i and a } 

int constants gets unnecessary large by shifting a<<8
but in case you can compare to strings somehow it should be the most natural

146 Using string comparison

#define s|a==*(int*) a,b;main(i){for(;~(b=getchar());printf(" %c"+!!i,b),a|=b<<8*i++)if(i>4 s"zero"s"one"s"two"s"four"s"five"s"six"s"nine")a=i=0;} 

Using String comparison

deleted 3 characters in body
Source Link
Loading
deleted 3 characters in body
Source Link
Loading
deleted 18 characters in body
Source Link
Loading
added 175 characters in body
Source Link
Loading
deleted 5 characters in body
Source Link
Loading
added 492 characters in body
Source Link
Loading
added 106 characters in body
Source Link
Loading
added 246 characters in body
Source Link
Loading
Source Link
Loading