Flatten a list

Write a program that prints every given list flattened. For example,
[[[a]], b] flattened is [a, b], and [[a, b], [c, d]] flattened is
[a, b, c, d].

Define and use a recursive function

    flatten(t)

that flattens a list t.

Hint

Using the @ast@ package, you can extract the list t encoded in a string
s with @t = ast.literal_eval(s)@.

Input

The input consists of several lists.

Output

Print every given list flattened.

Problem information

Author: Gabriel Valiente

Generation: 2026-01-25T17:16:35.768Z

© Jutge.org, 2006–2026.
https://jutge.org
