find redundant elelment and stored into index array
able to find longest common string and print it