Half String - 2
Write a program that prints the second half of the given input string.
You can assume that the length of the input string will always be an even number.
The first line of input is a string.
The output should be a string.
In the given string
messages, the length of the string is 8. The last 4 characters i.e The second half of the string is ages. So the output should be
ages.
Sample Input 1
messages
Sample Output 1
ages
Sample Input 2
time
Sample Output 2
me
string1 = input('Enter string with its length as even number: ')
n = int(len(string1)/2)
string2 = string1[n:]
print(string2)
Comments
Leave a comment