Adds longestStringForEach function.