Concepts involved are : Consonants
, Vowels
, Functions in Python
, Lists in Python
Write a Python program to traverse a string to an consonant or an ovel by following the below instructions.
- You need to start traversing from index k till end of string and then you can traverse back from end to beginning.
- At index k you need to check if the character is vowel or consonant.
- If it vowel you need to convert it into any consonant and vice versa and according you need to convert entire string into one kind of characters i.e vowels or consonants.
- Now the cost of moving from one index to next index is 1 coin and cost of converting a character into another character is also 1 coin.
- Output should be total cost to get desired output string.
Sample Input: aeioaaeiou
.
I picked another Input VIJAYAWADA
. But process never stops because this string has Consonant, Vowel and so on. Now the program runs life time or may be breaks at a point 2^n
with an error.
So if you want to look out possible output please enter the Sample Input Information.