Skip to main content
Commonmark migration
Source Link

##Pyth, 20 18 bytes

Pyth, 20 18 bytes

.Uu:G`CHHsrBG1+bZz

Same algorithm as @Dennis. It's a lot easier to code in Pyth on my phone than in Jelly.

                implicit: z=input
.U              Reduce the following lambda b, Z over z
                b is the string being built; z is the next char
   u                Reduce the following lambda G,H over +bZ
                    G is the string, H is the next letter to match
     :                  Replace
       G                in G
       ` C H            the char code of H
       H                with H
     s rB            where H takes on values:
          G              the lowercase alphabet (that's the global value of G)
          1              concatenated to its uppercased self.
     +          
       b
       Z
   z

Thanks @isaacg

Try it here.

##Pyth, 20 18 bytes

.Uu:G`CHHsrBG1+bZz

Same algorithm as @Dennis. It's a lot easier to code in Pyth on my phone than in Jelly.

                implicit: z=input
.U              Reduce the following lambda b, Z over z
                b is the string being built; z is the next char
   u                Reduce the following lambda G,H over +bZ
                    G is the string, H is the next letter to match
     :                  Replace
       G                in G
       ` C H            the char code of H
       H                with H
     s rB            where H takes on values:
          G              the lowercase alphabet (that's the global value of G)
          1              concatenated to its uppercased self.
     +          
       b
       Z
   z

Thanks @isaacg

Try it here.

Pyth, 20 18 bytes

.Uu:G`CHHsrBG1+bZz

Same algorithm as @Dennis. It's a lot easier to code in Pyth on my phone than in Jelly.

                implicit: z=input
.U              Reduce the following lambda b, Z over z
                b is the string being built; z is the next char
   u                Reduce the following lambda G,H over +bZ
                    G is the string, H is the next letter to match
     :                  Replace
       G                in G
       ` C H            the char code of H
       H                with H
     s rB            where H takes on values:
          G              the lowercase alphabet (that's the global value of G)
          1              concatenated to its uppercased self.
     +          
       b
       Z
   z

Thanks @isaacg

Try it here.

added 743 characters in body
Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127

##Pyth, 2020 18 bytes

JG.Uu:G`CHHsrBJ1+bZzG`CHHsrBG1+bZz

Posting from my phone; sameSame algorithm as @Dennis. Will add explanation when I get toIt's a computerlot easier to code in Pyth on my phone than in Jelly.

                implicit: z=input
.U              Reduce the following lambda b, Z over z
                b is the string being built; z is the next char
   u                Reduce the following lambda G,H over +bZ
                    G is the string, H is the next letter to match
     :                  Replace
       G                in G
       ` C H            the char code of H
       H                with H
     s rB            where H takes on values:
          G              the lowercase alphabet (that's the global value of G)
          1              concatenated to its uppercased self.
     +          
       b
       Z
   z

Thanks @isaacg

Try it herehere.

##Pyth, 20 bytes

JG.Uu:G`CHHsrBJ1+bZz

Posting from my phone; same algorithm as @Dennis. Will add explanation when I get to a computer.

Try it here.

##Pyth, 20 18 bytes

.Uu:G`CHHsrBG1+bZz

Same algorithm as @Dennis. It's a lot easier to code in Pyth on my phone than in Jelly.

                implicit: z=input
.U              Reduce the following lambda b, Z over z
                b is the string being built; z is the next char
   u                Reduce the following lambda G,H over +bZ
                    G is the string, H is the next letter to match
     :                  Replace
       G                in G
       ` C H            the char code of H
       H                with H
     s rB            where H takes on values:
          G              the lowercase alphabet (that's the global value of G)
          1              concatenated to its uppercased self.
     +          
       b
       Z
   z

Thanks @isaacg

Try it here.

Source Link
lirtosiast
  • 21.5k
  • 5
  • 52
  • 127

##Pyth, 20 bytes

JG.Uu:G`CHHsrBJ1+bZz

Posting from my phone; same algorithm as @Dennis. Will add explanation when I get to a computer.

Try it here.