The input of the program is the string s. Using character references by index and string slices, print the following substrings:
- all characters from index 3 to the middle of the string inclusive (if the length of the string is odd, do not take the middle character);
- last character;
- all characters with even indexes (0, 2, ...);
- all characters with odd indices (1, 3, ...);
- all characters except the last one;
- all characters except the first one;
- all characters in reverse order;
- all characters in reverse order, starting with 3 from the end, and except for the first two;
- all characters of the first half in reverse order, except for the first (if the length of the line is odd, do not take the middle character);
- slicing copy the entire string s to the string
s2
.
Add lines to the program.
Examples
# |
Input |
Output |
1 |
Hallo, World! |
lo,
!
Hlo ol!
al,Wrd
Hallo, World
Hello, World!
!dlroW ,ollaH
lroW ,oll
,olla
Hallo, World! |