CF988B Substrings Sort

题目描述

给定一个数n和n个字符串,求一个重新排列,对于新排列中的每个字符串 都满足在它前面的串都是它的子串。 感谢@南方不败 提供翻译

输入格式

第一行n,第二行开始n个字符串

输出格式

If it is impossible to reorder $ n $ given strings in required order, print "NO" (without quotes). Otherwise print "YES" (without quotes) and $ n $ given strings in required order.

说明/提示

In the second example you cannot reorder the strings because the string "abab" is not a substring of the string "abacaba".