improved version of problem1 with #map and #join and an extra test case