Slices. Given a string, perform the following operations and print the results:
- Print the third character of the string.
- Print the second to last character of the string.
- Print the first five characters of the string.
- Print all but the last two characters of the string.
- Print all the characters of the string with even indices.
- Print all the characters of the string with odd indices.
- Print all the characters of the string in reverse order.
- Print every second character of the string in reverse order, starting from the last one.
- 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 |