Removed filter and added if.
Solved problem 27.
Added a comment about strategy.
Solved problem 28.
Removed unnecessary tuple.
Used  and inlined frequency group function.