Count characters and display columns

An editor places tab stops, the columns to which a tab advances the cursor, at columns 4, 8, 12 and so on. Each sequence below begins at column 0. A space advances the cursor by one column; a tab advances it to the next tab stop strictly to its right.


For each sequence, enter the number of stored whitespace characters and the final cursor column as exact integers. Each tab and each space counts as one stored character. A tab does not always advance the cursor by four columns.

Whitespace sequenceStored charactersFinal cursor column
One tab followed by two spaces
Two spaces, one tab, then one space
One space followed by two tabs
Four spaces followed by one tab

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Editors Questions: