Skip to main content
added 574 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Jelly, 8 bytes

Ḣ1¦UðḤ}¡

Try it online!

How it works

Ḣ1¦UðḤ}¡  Main link. Left input: S (string). Right input: N (deletions)

Ḣ         Pop the first element of S.
          This return the element and modifies S.
 1¦       Apply the result to the first index.
          This replaces the first character of the popped S with the popped char.
   U      Upend/reverse the resulting string.
    ð     Convert the preceding chain into a (dyadic) link.
     Ḥ}   Apply double to the right input.
          This yields 2N.
       ¡  Repeat the link 2N times.

Jelly, 8 bytes

Ḣ1¦UðḤ}¡

Try it online!

Jelly, 8 bytes

Ḣ1¦UðḤ}¡

Try it online!

How it works

Ḣ1¦UðḤ}¡  Main link. Left input: S (string). Right input: N (deletions)

Ḣ         Pop the first element of S.
          This return the element and modifies S.
 1¦       Apply the result to the first index.
          This replaces the first character of the popped S with the popped char.
   U      Upend/reverse the resulting string.
    ð     Convert the preceding chain into a (dyadic) link.
     Ḥ}   Apply double to the right input.
          This yields 2N.
       ¡  Repeat the link 2N times.
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Jelly, 8 bytes

Ḣ1¦UðḤ}¡

Try it online!