Longest Common Prefix
Find the longest prefix shared by all words. Print -1 if there is none.
Input
, then lowercase words, one per line.
Output
The prefix or -1.
Constraints
Sample 1
Input
3 flower flow flight
Output
fl
Sample 2
Input
2 dog car
Output
-1