LearnPy Hub
← Inheritance & Special Methods problems
Hard

Indexable Class

Write Sentence(text) with __getitem__ returning the i-th word and __len__ the word count. Read a sentence and an index list; print the word at each index (negative allowed) on one line.

Input

A sentence, then indexes.

Output

One line.

Sample 1

Input
the quick brown fox
0 -1 2
Output
the fox brown
4

Sample 2

Input
hello
0
Output
hello
1
solution.py
Output appears here
Indexable Class · Python practice problem · LearnPy Hub