Incomparable Pairs
Time limit3sMemory limit512 MB
Count unordered pairs of substrings of a string s where neither substring is contained in the other.
- Level
Hard8 of 10
- Topics
- String, Tree, String matching
- Solved
- No attempts yet
Problem
You are given a string . Consider an unordered pair of its substrings . Call such a pair incomparable if neither is a substring of nor is a substring of . Compute the number of incomparable pairs of substrings of .
Input
The first line contains a single string consisting of lowercase English letters ().
Output
Output a single integer, the answer to the problem.