added solution to matchNestedElementOfListWithHeadTailPatternMatching