#C4681. License Compliance Check
License Compliance Check
License Compliance Check
In this problem, you are given an integer ( n ) and ( n ) license strings. Your task is to determine whether there exists a pair of distinct license strings such that one string is a substring of the other. Formally, given a list of strings ( L = [s_1, s_2, \dots, s_n] ), check if there exist indices ( i ) and ( j ) with ( i \neq j ) such that ( s_i ) is a substring of ( s_j ). If such a pair exists, output "YES"; otherwise, output "NO". This problem tests your ability to work with string operations and nested loops.
inputFormat
The first line contains an integer ( n ) (the number of license strings). The next ( n ) lines each contain a license string.
outputFormat
Output a single line containing "YES" if there exists a license string that is a substring of another license string; otherwise, output "NO".## sample
4
abcd
efgh
ab
ef
YES