CF137E.Last Chance

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Having read half of the book called "Storm and Calm" on the IT lesson, Innocentius was absolutely determined to finish the book on the maths lessons. All was fine until the math teacher Ms. Watkins saw Innocentius reading fiction books instead of solving equations of the fifth degree. As during the last maths class Innocentius suggested the algorithm of solving equations of the fifth degree in the general case, Ms. Watkins had no other choice but to give him a new task.

The teacher asked to write consecutively (without spaces) all words from the "Storm and Calm" in one long string s. She thought that a string is good if the number of vowels in the string is no more than twice more than the number of consonants. That is, the string with v vowels and c consonants is good if and only if v ≤ 2_c_.

The task Innocentius had to solve turned out to be rather simple: he should find the number of the longest good substrings of the string s.

在信息技术课上读完《暴风雨与宁静》这本书的一半后,无辜者(Innocentius)下定决心要在数学课上把这本书读完。一切都很顺利,直到数学老师沃特金斯女士(Ms. Watkins)发现无辜者没有解五次方程,而是在读小说。由于在上一节数学课上,无辜者曾提出了一个求解一般情形下五次方程的算法,沃特金斯女士别无选择,只得给他布置一项新任务。

老师要求将《暴风雨与宁静》一书中的所有单词连续地(中间不加空格)拼接成一个长字符串 $ s $。她定义一个字符串是“好”的,当且仅当该字符串中元音字母的个数不超过辅音字母个数的两倍。即:若字符串中有 $ v $ 个元音字母和 $ c $ 个辅音字母,则该字符串是“好”的当且仅当 $ v \leq 2c $。

无辜者需要解决的任务出人意料地简单:他需找出字符串 $ s $ 中最长的好子串的个数。

输入格式

The only input line contains a non-empty string s consisting of no more than 2·105 uppercase and lowercase Latin letters. We shall regard letters "a", "e", "i", "o", "u" and their uppercase variants as vowels.

唯一的一行输入包含一个非空字符串 ss,该字符串由至多 2⋅1052 \cdot 10^5 个大小写拉丁字母组成。我们将字母 “a”、“e”、“i”、“o”、“u” 及其大写形式视为元音字母。

输出格式

Print on a single line two numbers without a space: the maximum length of a good substring and the number of good substrings with this length. If no good substring exists, print "No solution" without the quotes.

Two substrings are considered different if their positions of occurrence are different. So if some string occurs more than once, then it should be counted more than once.

在一行中输出两个数字(中间不加空格):最长的“好”子串的长度,以及具有该长度的“好”子串的个数。若不存在“好”子串,则输出 No solution(不带引号)。

如果两个子串出现的位置不同,则认为它们是不同的子串。因此,若某个字符串多次出现,则应多次计数。

输入输出样例

  • 输入#1

    Abo

    输出#1

    3 1
  • 输入#2

    OEIS

    输出#2

    3 1
  • 输入#3

    auBAAbeelii

    输出#3

    9 3
  • 输入#4

    AaaBRAaaCAaaDAaaBRAaa

    输出#4

    18 4
  • 输入#5

    EA

    输出#5

    No solution

说明/提示

In the first sample there is only one longest good substring: "Abo" itself. The other good substrings are "b", "Ab", "bo", but these substrings have shorter length.

In the second sample there is only one longest good substring: "EIS". The other good substrings are: "S", "IS".

在第一个样例中,仅存在一个最长的优秀子串:“Abo”本身。其余的优秀子串有“b”、“Ab”、“bo”,但这些子串的长度更短。

在第二个样例中,仅存在一个最长的优秀子串:“EIS”。其余的优秀子串有:“S”、“IS”。

输入解题思路,AI测评打分。不知道怎么写?

首页