Skip to main content
deleted 7 characters in body
Source Link
coltim
  • 6.1k
  • 7
  • 13

K (ngn/k), 2323 16 bytes

-7 bytes by rereading question (specifically, "^ will only appear as ^H")

{x_/3#-1+*(2'x)1+x?,"^H""^"}/

Try it online!Try it online!

Feels a bit hacky; removesRemoves one instance of ?^H on each invocation, and is run until convergence (i.e. no more ^H^'s are present).

  • {...}/ run function on (implicit) input until it converges
  • (2'x) take 2-length sliding windows of the input
  • -1+*(...)1+x?,"^H""^" get the index of the character immediately prior to the first ^H^ in x
  • x_/3# drop the value occurring at that index three times

K (ngn/k), 23 bytes

{x_/3#-1+*(2'x)?,"^H"}/

Try it online!

Feels a bit hacky; removes one instance of ?^H on each invocation, and is run until convergence (i.e. no more ^H's are present).

  • {...}/ run function on (implicit) input until it converges
  • (2'x) take 2-length sliding windows of the input
  • -1+*(...)?,"^H" get the index of the character immediately prior to the first ^H in x
  • x_/3# drop the value occurring at that index three times

K (ngn/k), 23 16 bytes

-7 bytes by rereading question (specifically, "^ will only appear as ^H")

{x_/3#-1+x?"^"}/

Try it online!

Removes one instance of ?^H on each invocation, and is run until convergence (i.e. no more ^'s are present).

  • {...}/ run function on (implicit) input until it converges
  • -1+x?"^" get the index of the character immediately prior to the first ^ in x
  • x_/3# drop the value occurring at that index three times
Source Link
coltim
  • 6.1k
  • 7
  • 13

K (ngn/k), 23 bytes

{x_/3#-1+*(2'x)?,"^H"}/

Try it online!

Feels a bit hacky; removes one instance of ?^H on each invocation, and is run until convergence (i.e. no more ^H's are present).

  • {...}/ run function on (implicit) input until it converges
  • (2'x) take 2-length sliding windows of the input
  • -1+*(...)?,"^H" get the index of the character immediately prior to the first ^H in x
  • x_/3# drop the value occurring at that index three times