added longest common prefix solution