This is Advanced Question for HW1.
Write a program that takes a string as input and outputs a modified version of the string, according to the following rules:
If the length of the string is odd, reverse the string and capitalize the first letter.
If the length of the string is even, replace the middle two characters with the characters "42".
Note that, in Python Language, you can use the function len()
to get the number of characters of a string. (Whitespace also counts in the length of string)
A string of characters on a single line.
The modified version of the input string, according to the above rules.