Slices

Slices. Given a string, perform the following operations and print the results:

  1. Print the third character of the string.
  2. Print the second to last character of the string.
  3. Print the first five characters of the string.
  4. Print all but the last two characters of the string.
  5. Print all the characters of the string with even indices.
  6. Print all the characters of the string with odd indices.
  7. Print all the characters of the string in reverse order.
  8. Print every second character of the string in reverse order, starting from the last one.
  9. Print the length of the given string.
Test Case Input (String) Expected Output
1 example a
l
examp
exam
eape
xml
elpmaxe
epm
7
2 programming o
n
progr
programm
poramn
rgmig
gnimmargorp
gimr
11
3 hello l
l
hello
hel
hlo
el
olleh
lo
5