{"raw_statement":[{"iden":"statement","content":"You are given a string s = s1s2... sn. Consider an unordered pair of its substrings {a, b}. Let us call such pair _incomparable_ if neither a is a substring of b nor b is a substring of a. You have to compute the number of incomparable pairs of substrings of s.\n\nThe first line of input contains a single string s consisting of lowercase English letters (1 ≤ |s| ≤ 105).\n\nOutput a single integer which is the answer to the problem.\n\n"},{"iden":"input","content":"The first line of input contains a single string s consisting of lowercase English letters (1 ≤ |s| ≤ 105)."},{"iden":"output","content":"Output a single integer which is the answer to the problem."},{"iden":"examples","content":"Inputabba\nOutput8\nInputabacaba\nOutput64\n"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ s = s_1 s_2 \\dots s_n $ be a string of length $ n \\geq 1 $ over the alphabet of lowercase English letters.  \nLet $ \\mathcal{S} $ be the set of all non-empty substrings of $ s $.  \n\n**Constraints**  \n$ 1 \\leq n \\leq 10^5 $\n\n**Objective**  \nCompute the number of unordered pairs $ \\{a, b\\} \\subseteq \\mathcal{S} $, $ a \\neq b $, such that neither $ a $ is a substring of $ b $ nor $ b $ is a substring of $ a $.","simple_statement":"Given a string s, count the number of unordered pairs of substrings where neither is a substring of the other.","has_page_source":false}