Skip to main content
Bit twiddling
Source Link
ErikF
  • 4.7k
  • 8
  • 11

C (gcc), 111 109 101101 100 bytes

Edit: Added lowercasing per @FrownyFrog's comment; thanks to Lynn, Christoph and user5329483 for their suggestions!

f(s,t,i)char*s,*t;{for(t=s;t=strchr(t,95);*t=65+i;*t=i+1)for(i=1;i<32;s++i=3;i<64;s++)isalpha(*s)?i=2*i|*s<97,*s|=32:0;}

Try it online!Try it online!

C (gcc), 111 109 101 bytes

Edit: Added lowercasing per @FrownyFrog's comment; thanks to Lynn, Christoph and user5329483 for their suggestions!

f(s,t,i)char*s,*t;{for(t=s;t=strchr(t,95);*t=65+i)for(i=1;i<32;s++)isalpha(*s)?i=2*i|*s<97,*s|=32:0;}

Try it online!

C (gcc), 111 109 101 100 bytes

Edit: Added lowercasing per @FrownyFrog's comment; thanks to Lynn, Christoph and user5329483 for their suggestions!

f(s,t,i)char*s,*t;{for(t=s;t=strchr(t,95);*t=i+1)for(i=3;i<64;s++)isalpha(*s)?i=2*i|*s<97,*s|=32:0;}

Try it online!

More code reductions
Source Link
ErikF
  • 4.7k
  • 8
  • 11

C (gcc), 111 109109 101 bytes

Edit: Added lowercasing per @FrownyFrog's commentcomment; thanks to Lynn, Christoph and saved 2 bytes from @Lynn's suggestion.user5329483 for their suggestions!

f(s,t,i,j)char*s,*t;{for(t=s;t=strchr(t,95);*t=97+i;*t=65+i)for(i=j=0;j<5;s++i=1;i<32;s++)isalpha(*s)?i+=i+(*s<97)i=2*i|*s<97,*s|=32,j++:0;}

Try it online!Try it online!

C (gcc), 111 109 bytes

Edit: Added lowercasing per @FrownyFrog's comment and saved 2 bytes from @Lynn's suggestion.

f(s,t,i,j)char*s,*t;{for(t=s;t=strchr(t,95);*t=97+i)for(i=j=0;j<5;s++)isalpha(*s)?i+=i+(*s<97),*s|=32,j++:0;}

Try it online!

C (gcc), 111 109 101 bytes

Edit: Added lowercasing per @FrownyFrog's comment; thanks to Lynn, Christoph and user5329483 for their suggestions!

f(s,t,i)char*s,*t;{for(t=s;t=strchr(t,95);*t=65+i)for(i=1;i<32;s++)isalpha(*s)?i=2*i|*s<97,*s|=32:0;}

Try it online!

Code shortening
Source Link
ErikF
  • 4.7k
  • 8
  • 11

C (gcc), 111111 109 bytes

Edit: Added lowercasing per @FrownyFrog's comment and saved 2 bytes from @Lynn's suggestion.

f(s,t,i,j)char*s,*t;{for(t=s;t=strchr(t,95);*t=97+i)for(i=j=0;j<5;s++)isalpha(*s)?i=i*2+!i+=i+(*s&32*s<97),*s|=32,j++:0;}

Try it online!Try it online!

C (gcc), 111 bytes

Edit: Added lowercasing per @FrownyFrog's comment.

f(s,t,i,j)char*s,*t;{for(t=s;t=strchr(t,95);*t=97+i)for(i=j=0;j<5;s++)isalpha(*s)?i=i*2+!(*s&32),*s|=32,j++:0;}

Try it online!

C (gcc), 111 109 bytes

Edit: Added lowercasing per @FrownyFrog's comment and saved 2 bytes from @Lynn's suggestion.

f(s,t,i,j)char*s,*t;{for(t=s;t=strchr(t,95);*t=97+i)for(i=j=0;j<5;s++)isalpha(*s)?i+=i+(*s<97),*s|=32,j++:0;}

Try it online!

Removed unnecessary variable, added lowercasing
Source Link
ErikF
  • 4.7k
  • 8
  • 11
Loading
Source Link
ErikF
  • 4.7k
  • 8
  • 11
Loading