Skip to content

Practice Make The String Great

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

Easy#1544
LeetCode Problem

Make The String Great

Problem Statement

Repeatedly remove an adjacent pair when its letters are the same alphabetic letter with opposite case, such as aA or Aa. Stop when no such pair remains and return the resulting string. The result is guaranteed to be unique, and an empty string is valid.

Source: Make The String Great on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "leEeetcode"
Output
"leetcode"

# Example 2

Input
s = "abBAcC"
Output
""

# Example 3

Input
s = "s"
Output
"s"

Constraints

1 <= s.length <= 100
s contains only lower and upper case English letters.

Related LeetCode Problems

Practice more problems similar to Make The String Great.

Review your practice with PhantomCodeAI

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