cswork / OA打开练习工作台

AmazonOA #323

Find Password Strength

估计简单可在线判题

考点(AI 标注)贪心调度字符串

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.

输入格式

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 a single integer, the answer.

样例 1

输入:

hackerrank

输出:

3

样例 2

输入:

aeiou

输出:

0

样例 3

输入:

abaaa

输出:

1

样例说明

The answers are 3, 0 and 1. In the last example the suffix aaa joins the segment containing ab; the suffix is not discarded.