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.
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:
HelloSample Output 1:
HeloSample Input 2:
abcdSample Output 2:
adCreate a free account to access the full topic