#C13123. Text Transformation Challenge
Text Transformation Challenge
Text Transformation Challenge
This problem requires you to apply a series of text transformations on an input string. The supported transformations include reversing the string, converting all characters to uppercase or lowercase, removing vowels, and counting vowels. The transformations should be applied in the order in which they are provided. If the transformation count_vowels
appears, your program must output the number of vowels immediately without applying further transformations. Additionally, if a transformation is applied with a multiplier times, then that transformation should be executed that many times in sequence.
For example, applying reverse
followed by uppercase
to "hello world" yields "DLROW OLLEH", and applying count_vowels
to "hello world" yields 3.
inputFormat
The input consists of three lines:
- The first line contains the input string.
- The second line contains a comma-separated list of transformation names. The valid transformation names are:
reverse
,uppercase
,lowercase
,remove_vowels
, andcount_vowels
. - The third line contains an integer specifying the number of times each transformation (except
count_vowels
) should be applied.
outputFormat
Output the final transformed string. If the count_vowels
transformation is used, output the count (an integer) as a string.
hello
reverse
1
olleh