#P1666. 前缀单词
前缀单词
Description
A set of words is safe if and only if no word is a prefix of another word; this ensures that the data is not easily misunderstood. Now you have a word set , and you need to count how many of its subsets are safe.
Note that the empty set is always safe.
Input Format
The first line contains an integer , the size of the set. Then lines follow. Each line contains a string consisting of \verb!a!\cdots\verb!z!.
Output Format
The number of safe subsets.
3
hello
hell
hi
6
Hint
Constraints and Conventions
- For of the testdata, it holds that .
- For of the testdata, it holds that , string length , and no two strings are exactly the same.
Translated by ChatGPT 5
京公网安备 11011102002149号