{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"Give you a string S,assume the Sub-String Stri \u003d S[0..i] and the length of the string is N. e.g. S \u003d \"moreandmorecold\", N \u003d 15, Str0 \u003d \"m\" Str1 \u003d \"mo\" Str2 \u003d \"mor\" and so on.\n\u003cbr\u003e And we define c[i] indicate how many Sub-String Stri in S, now please calculate the sum of c[0] to c[N-1].\n\u003cbr\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line include a number T, means the number of test cases.\n\u003cbr\u003e For each test case, just a line only include lowercase indicate the String S, the length of S will less than 100000.\n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Fore each test case, just a number means the sum.\n\u003cbr\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e3\r\nacacm\r\nmoreandmorecold\r\nthisisthisththisisthisisthisththisis\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e7\r\n19\r\n82\r\n\r\nFor the first case,\r\nthere are two \"a\",\"ac\" and one \"aca\",\"acac\",\"acacm\" in the string \"acacm\".\r\nSo the answer is 2 + 2 + 1 + 1 + 1 \u003d 7\u003c/pre\u003e"}}]}