from AtCoder Library Practice Contest ACLPC_I I - Number of Substrings 接尾辞配列を構築して、LCP配列も作る LCPの値は「同じ部分文字列の数」なので、全部の部分文字列の数からそれを引けば良い