solution for longest common prefix

Signed-off-by: Mory Mobile <mory.mobile@gmail.com>