main fucntion now calls beginend and findmatch and returns a sequence of colors, print statements added for clarity