Олимпиадный тренинг

Задача 39830. Indexes and slices


Задача

Темы: Символы Строки
The input of the program is the string s.  Using character references by index and string slices, print the following substrings:
  1. 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);
  2. last character;
  3. all characters with even indexes (0, 2, ...);
  4. all characters with odd indices (1, 3, ...);
  5. all characters except the last one;
  6. all characters except the first one;
  7. all characters in reverse order;
  8. all characters in reverse order, starting with 3 from the end, and except for the first two;
  9. 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);
  10. 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!