Beautiful Substring

5

2 votes
Problem

A string is said to be beautiful if the number of consonants is less than or equal to thrice the number of vowels, i.e if there are a consonants and b vowels then, a3b

You have to find out the length of the longest beautiful substring of the given string and the number of times a beautiful substring appears with this length.

Input:
The first line of the input contains T, the number of test cases. Then follows T lines.
Each line contains a string S.

Output:
For each test case print on a single line two numbers separated by a space: the maximum length of a beautiful substring and the number of beautiful substrings with this length. If no beautiful substring exists, print "-1" (without quotes).

Constraints:
1T500

1length(S)105

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?