You are given an array of `words` where each word consists of lowercase English letters.
`wordA` is a predecessor of `wordB` if and only if we can insert exactly one letter anywhere in `wordA` without changing the order of the other characters to make it equal to `wordB`.
A word chain is a sequence of words `[word_1, word_2, ..., word_k]` with `k >= 1`, where `word_1` is a predecessor of `word_2`, `word_2` is a predecessor of `word_3`, and so on.
Return the length of the longest possible word chain with words chosen from the given list of `words`.
### Constraints
- `1 <= words.length <= 1000`
- `1 <= words[i].length <= 16`
- All words consist of lowercase English letters.
### Input Format
A single line containing space-separated words.
### Output Format
Print the length of the longest possible word chain.
Sample Cases
Example 1Sample Case
Input: a b ba bca bda bdca
Output: 4
Example 2Sample Case
Input: x bc cx c
Output: 2
Example 3Sample Case
Input: aaaaaa
Output: 1
Constraints
Runtime Limit: 2000 ms per test batch
Memory Limit: 256 MB
Standard I/O stream reading
Official submissions are evaluated against hidden test cases on the server to verify time & memory complexity.