LearnPy Hub
← Lists problems
Hard

Group Equal Neighbours

Read a list of integers and group runs of equal neighbouring values into sub-lists. Print the list of lists.

Input

One line.

Output

A list of lists.

Sample 1

Input
1 1 2 3 3 3 1
Output
[[1, 1], [2], [3, 3, 3], [1]]

Sample 2

Input
5
Output
[[5]]
solution.py
Output appears here
Group Equal Neighbours · Python practice problem · LearnPy Hub