#P7021. Maximize Consonant Fencity
Maximize Consonant Fencity
Maximize Consonant Fencity
There are two kinds of sounds in spoken languages: vowels and consonants. A vowel is produced with an open vocal tract, and a consonant is pronounced with at least partial obstruction of the breath. In this problem, the vowels are defined as \(a, e, i, o, u, w, y\). All other letters are consonants.
Define the consonant fencity of a string as the number of pairs of consecutive letters in the string that are both consonants and have different cases (i.e. one is lowercase and the other is uppercase). For example, if the string were CoNsoNaNts
, its consonant fencity would be \(2\); for dEsTrUcTiOn
it would be \(3\); and for StRenGtH
it would be \(5\).
You are given a string consisting of lowercase English letters. Your task is to change the case of some letters so that all occurrences of the same letter have the same case, and the resulting string has the maximal possible consonant fencity. Note that you are free to choose the case for vowels, but since they do not contribute to the fencity, you may simply keep them in lowercase.
Output the resulting string.
inputFormat
The input consists of a single line containing a string of lowercase English letters.
outputFormat
Output a single string that is obtained by changing the case of some letters (ensuring that all instances of the same letter have the same case) so that the consonant fencity is maximal.
sample
consonants
A valid output where each consonant letter is assigned either lowercase or uppercase consistently and the maximum possible fencity is achieved.