Cutting out the middle of a string

Report a typo

Write a program that reads a string, and then outputs the string without its middle character when the length is odd, and without the middle 2 characters when the length is even.

Tip:

Remember substring() method. It can help you a lot.

Sample Input 1:

Hello

Sample Output 1:

Helo

Sample Input 2:

abcd

Sample Output 2:

ad
Write a program in Kotlin
fun main() {
// write your code here
}
___

Create a free account to access the full topic