6

This puzzle is created by me.


String 1:

  This is an example paragraph. It contains multiple sentences.
  In addition to multiple sentences,
  it contains multiple lines, as well as indentations.

String 2:

This is an example paragraph, but changed slightly. It contains multiple sentences.
In addition to multiple sentences,
it contains multiple lines, as well as minor changes, like having no indentations.
In addition to multiple sentences, it also contains a partially repeated sentence.

The puzzle:

Find the minimum number of keystrokes to turn String 1 into String 2.

Rules:

  • Your cursor starts at the very end String 1 (after all characters).
  • You may only use the keyboard and arrow keys, no mouse / trackpad.
  • The keyboard used should be a standard, U.S. QWERTY keyboard, with no custom keys.
  • You may use common keyboard shortcuts, but they count as multiple keystrokes (e.g. CTRL + BACKSPACE counts for 2 keystrokes).
  • A common keyboard shortcut is one that works by default in all major operating systems (so no custom keybindings).
  • You may not use keyboard shortcuts specific to the text editor or application; the solution should be generic and applicable to any text editor.
  • Your clipboard is empty, but may be used.
  • Typing a character counts for 1 keystroke, even if SHIFT is used. However, if SHIFT is used in a keyboard shortcut, it counts as multiple keystrokes.
Blue Herring
  • 1,491
  • 4
  • 24

1 Answers1

6

I initially thought that copying and pasting individual words/character strings might be beneficial, but since every Ctrl + C and Ctrl + V is counted as two keypresses, it would only make sense if the word was very long.

My solution takes 141 keypresses:

Ctrl + ←Ctrl + ←

minor<space>changes,<space>like<space>having<space>no<space>

Shift + HomeCtrl + C

HomeDelDel

Ctrl + VEnd

<space>it<space> also<space>contains<space>a<space>partially<space>repeated<space>sentence.

Ctrl + HomeDelDel

Ctrl + →Ctrl + →Ctrl + →Ctrl + →Ctrl + →

,<space>but <space>changed<space>slightly

HomeDownDownDelDel

I could argue that holding Ctrl and pressing five times is really only 6 keypresses instead of 10. If that's the case, my total count is 136.

GentlePurpleRain
  • 25,965
  • 6
  • 93
  • 155
  • About the last paragraph rot13(pna lbh hfr nhgbercrng)? – Weather Vane Nov 17 '23 at 19:03
  • @WeatherVane It would require awfully precise timing to end up at exactly the right location using autorepeat. – GentlePurpleRain Nov 17 '23 at 20:44
  • You can do that with practice. In theory too? – Weather Vane Nov 17 '23 at 20:45
  • 1
    down down ctrl-v end should not work, as there is no new line below the text. Notepad does nothing on the second down-arrow, Chrome puts the cursor at the end of the line. You also appear to be copying the indentation. – Daniel Mathias Nov 17 '23 at 23:11
  • 1
    As an alternative up home del del right shift+down ctrl+(c end v) should work, and may improve the count. – Daniel Mathias Nov 17 '23 at 23:12
  • Wait what's the Home key? I don't think I've ever seen one of those before. – CrSb0001 Nov 18 '23 at 01:03
  • Sorry, but technically the 5 CTRL + -->s count as individual keyboard shortcuts. Great job! – Blue Herring Nov 18 '23 at 03:05
  • 1
    @CrSb0001 Really? I probably use it dozens of times a day. It's with the other cursor-control keys (Del, Ins, End, PgUp, PgDn). It takes you to the beginning of a line. Ctrl+Home takes you to the beginning of a document. Shift+Home will highlight everything between your current cursor position and the beginning of the line. – GentlePurpleRain Nov 21 '23 at 19:43
  • @GentlePurpleRain Ohh that makes sense thank you okay I know what it means now – CrSb0001 Nov 21 '23 at 19:48