Skip to main content
Commonmark migration
Source Link

##Seriously, 17 bytes

Seriously, 17 bytes

,#,`p@pXod@dXq`nΣ

Takes input as s \n n.

Try it online!

Explanation:

,#,`p@pXod@dXq`nΣ
,#                 push a list of characters in s
  ,`          `n   do the following n times:
    p@pXo          pop 2 characters off the front, discard the second, put the first back
         d@dXq     pop 2 characters off the back, discard the second, put the first back
                Σ  join

##Seriously, 17 bytes

,#,`p@pXod@dXq`nΣ

Takes input as s \n n.

Try it online!

Explanation:

,#,`p@pXod@dXq`nΣ
,#                 push a list of characters in s
  ,`          `n   do the following n times:
    p@pXo          pop 2 characters off the front, discard the second, put the first back
         d@dXq     pop 2 characters off the back, discard the second, put the first back
                Σ  join

Seriously, 17 bytes

,#,`p@pXod@dXq`nΣ

Takes input as s \n n.

Try it online!

Explanation:

,#,`p@pXod@dXq`nΣ
,#                 push a list of characters in s
  ,`          `n   do the following n times:
    p@pXo          pop 2 characters off the front, discard the second, put the first back
         d@dXq     pop 2 characters off the back, discard the second, put the first back
                Σ  join
Source Link
user45941
user45941

##Seriously, 17 bytes

,#,`p@pXod@dXq`nΣ

Takes input as s \n n.

Try it online!

Explanation:

,#,`p@pXod@dXq`nΣ
,#                 push a list of characters in s
  ,`          `n   do the following n times:
    p@pXo          pop 2 characters off the front, discard the second, put the first back
         d@dXq     pop 2 characters off the back, discard the second, put the first back
                Σ  join