Tap here to switch tabs
Problem
Submissions

Problem: Faulty Keyboard

Faulty Keyboard transforms a typed string: ordinary letters append to the screen, while each 'i' reverses the current text. Return the final displayed string.

Statement

Given a string s, you are typing each character into a faulty laptop keyboard.

Whenever you type a character that is not 'i', that character is appended to the text on the screen. Whenever you type the character 'i', the text currently on the screen is reversed instead of appending the letter 'i'.

Return the final string displayed on the screen after typing all characters in s.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • s[0] ≠\neq 'i'

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Faulty Keyboard

Faulty Keyboard transforms a typed string: ordinary letters append to the screen, while each 'i' reverses the current text. Return the final displayed string.

Statement

Given a string s, you are typing each character into a faulty laptop keyboard.

Whenever you type a character that is not 'i', that character is appended to the text on the screen. Whenever you type the character 'i', the text currently on the screen is reversed instead of appending the letter 'i'.

Return the final string displayed on the screen after typing all characters in s.

Constraints:

  • 1≤1 \leq s.length ≤100\leq 100

  • s consists of lowercase English letters.

  • s[0] ≠\neq 'i'