Skip to content

Practice Faulty Keyboard

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2810
LeetCode Problem

Faulty Keyboard

Problem Statement

Your laptop keyboard is faulty, and whenever you type a character 'i' on it, it reverses the string that you have written. Typing other characters works as expected. You are given a 0-indexed string s, and you type each character of s using your faulty keyboard. Return the final string that will be present on your laptop screen.

Source: Faulty Keyboard on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "string"
Output
"rtsng"

# Example 2

Input
s = "poiinter"
Output
"ponter"

Constraints

1 <= s.length <= 100
s consists of lowercase English letters.
s[0] != 'i'

Related LeetCode Problems

Practice more problems similar to Faulty Keyboard.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.