Learn
Practice
Newsletter
Resources
Mobile
New
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Number of Good Ways to Split a String
Bookmark
Input
Example 1
Example 2
Example 3
Custom
s
=
aacaba
s
a
a
c
a
b
a
left
(empty)
distinct
0
right
(empty)
distinct
0
good splits = 0
s
a
a
c
a
b
a
left
(empty)
distinct
0
right
(empty)
distinct
0
good splits = 0
s
a
a
c
a
b
a
i
left
(empty)
distinct
0
right
a
2
distinct
1
good splits = 0
s
a
a
c
a
b
a
left
(empty)
distinct
0
right
a
4
b
1
c
1
distinct
3
good splits = 0
s
a
a
c
a
b
a
split
left
a
1
distinct
1
right
a
4
b
1
c
1
distinct
3
1
≠
3
good splits = 0
s
a
a
c
a
b
a
split
left
a
2
distinct
1
right
a
3
b
1
c
1
distinct
3
1
≠
3
good splits = 0
s
a
a
c
a
b
a
split
left
a
2
c
1
distinct
2
right
a
2
b
1
c
1
distinct
3
2
≠
3
good splits = 0
s
a
a
c
a
b
a
split
left
a
3
c
1
distinct
2
right
a
2
b
1
distinct
2
2
==
2
good splits = 1
s
a
a
c
a
b
a
split
left
a
3
b
1
c
1
distinct
3
right
a
1
b
1
distinct
2
3
≠
2
good splits = 2
s
a
a
c
a
b
a
split
left
a
4
b
1
c
1
distinct
3
right
a
1
distinct
1
3
≠
1
good splits = 2
s
a
a
c
a
b
a
left
a
4
b
1
c
1
distinct
3
right
(empty)
distinct
0
good splits = 2
algo
master
.
io
Step:
A split is good when both halves have the same distinct-letter count
0 / 40
Input
Example 1
Example 2
Example 3
Custom
s
=
aacaba
0 / 40
algo
master
.
io
Step:
A split is good when both halves have the same distinct-letter count