Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: which string is ahead - menu

  • The code will first show two options like the following and ask the user to type in either 1 or 2.
1) by ABC
2) by length
  • Then the code will prompt the user for two strings and then print out which ahead comparing them either by their location in the ABC or by their length, depending on the first selection.