Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • \$\begingroup\$ Can you provide a test suite link also, please? \$\endgroup\$ Commented Oct 17, 2016 at 9:23
  • \$\begingroup\$ @ʰᵈˑ added an R-fiddle test suite. Note that the test suite uses a function instead of reading input from stdin as explained in the edited answer. \$\endgroup\$ Commented Oct 17, 2016 at 9:59
  • \$\begingroup\$ Is this answer valid, since you have to use " around the input string? \$\endgroup\$ Commented Oct 17, 2016 at 21:06
  • \$\begingroup\$ @rturnbull I don't see why not. Wrapping every entry with quotes and pressing enter would yield the equivalent result (e.g.: "Hello world" => enter => "-wo" => enter => "-ld" => enter => "+Ea" => enter =>"+th") which is usually how strings are read anyways. \$\endgroup\$ Commented Oct 17, 2016 at 21:16
  • 1
    \$\begingroup\$ Yeah it's really up to the OP! I personally like your answer as-is, but I was worried that it might be invalid. Looking at answers for other languages it seems like quotes are pretty accepted. While I have your attention, I think you can golf off 4 bytes by changing l=length(i) to l=length(i)/2 and updating the later references to l. \$\endgroup\$ Commented Oct 17, 2016 at 21:57