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: Hide substring

Given a string:

  • show 4 * characters and then the last 4 characters
  • show the first 4 characters and then 4 stars
  • replace every character, except the last 4 by a *
  • replace every character, except the first 4 by a *

Here the first line is the input, the rest are the 4 output strings:

0123456789
****6789
0123****
******6789
0123******