Find longest common motif