problem 9 - group elements
refactor according to hlint
problem 9 - some comments