Every Other Item

Lab Python Beginner 10 points

Read a line of words. Print the items at even positions (0, 2, 4, …) on one line, then the list reversed on the next line.

Input

One line of words.

Output

Two lines, items separated by spaces.

Example

Input

a b c d e

Output

a c e
e d c b a
Sample input available Sample output available
Editor
Python

Hints

Slices work on lists exactly like strings.

Solution explanation

items[::2] takes every second item; items[::-1] reverses.

Show solution
items = input().split()
print(*items[::2])
print(*items[::-1])
Output
Answer
HOME LEARN COMMUNITY DASHBOARD