#C7751. Longest Common Prefix
Longest Common Prefix
Longest Common Prefix
Given a list of strings, your task is to find the longest common prefix among them. The longest common prefix of a set of strings is the initial sequence of characters that is common to all the strings.
If there is no common prefix, output NO COMMON PREFIX.
For example, the longest common prefix of flower, flow and flight is fl.
inputFormat
The first line contains an integer (T) representing the number of test cases. Each test case begins with an integer (N), the number of strings, followed by (N) strings separated by whitespace or newlines. The input is provided via standard input (stdin).
outputFormat
For each test case, output a single line containing the longest common prefix. If no common prefix exists, output "NO COMMON PREFIX". The results should be printed to standard output (stdout).## sample
2
3
flower
flow
flight
3
dog
racecar
car
fl
NO COMMON PREFIX
</p>