added some low hanging fruit optimization and sorted dictbyCommonsubstring to print common substring with most matches first