Facebook Pixel

Amazon Online Assessment (OA) - Partition String

Given a string S of lowercase letters.

Partition S into as many parts as possible so that one letter only appears in one part.

Input

The input consists of one argument:

S: a string of lowercase letters

Output

Return the partitions as a list.

Examples

Example 1:

Input:

S = "bbeadcxede"

Output: ["bb", "eadcxede"]

Example 2:

Input:

S = "baddacx"

Output: ["b", "adda", "c", "x"]

Try it yourself

Invest in Yourself
Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.
Go Pro
Favorite (idle)