My solution to Longest Common Prefix