AmazonOA #323
Find Password Strength
Estimated EasyJudge-ready
Split the whole lowercase credential into non-empty contiguous segments; each segment must contain at least one vowel from aeiou and at least one other letter. The strength is the maximum number of segments; if the whole credential cannot satisfy both kinds of characters, return 0. Every character must be kept, so the tail cannot be discarded.
Input
One line containing credential. The original bounds are 1≤length≤10, with lowercase letters only. The corresponding raw is amazon-password-strength.md, not the other file with the same title, amazon-find-password-strength.md, which counts characters of substrings.
Output
Output a single integer, the answer.
Example 1
Input:
hackerrank
Output:
3
Example 2
Input:
aeiou
Output:
0
Example 3
Input:
abaaa
Output:
1
Example notes
The answers are 3, 0 and 1. In the last example the suffix aaa joins the segment containing ab; the suffix is not discarded.
Editorial
Loading solution…