B - Substring
Editorial
/


Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
英小文字からなる文字列 が与えられます。 の空でない部分文字列は何種類ありますか?
ただし、部分文字列とは連続する部分列のことを指します。例えば、xxx
は yxxxy
の部分文字列ですが、xxyxx
の部分文字列ではありません。
制約
- は英小文字からなる長さ 以上 以下の文字列
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
Copy
yay
出力例 1Copy
Copy
5
の空でない部分文字列は以下の 種類です。
a
y
ay
ya
yay
入力例 2Copy
Copy
aababc
出力例 2Copy
Copy
17
入力例 3Copy
Copy
abracadabra
出力例 3Copy
Copy
54
Score: points
Problem Statement
You are given a string consisting of lowercase English letters. How many different non-empty substrings does have?
A substring is a contiguous subsequence. For example, xxx
is a substring of yxxxy
but not of xxyxx
.
Constraints
- is a string of length between and , inclusive, consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
Copy
yay
Sample Output 1Copy
Copy
5
has the following five different non-empty substrings:
a
y
ay
ya
yay
Sample Input 2Copy
Copy
aababc
Sample Output 2Copy
Copy
17
Sample Input 3Copy
Copy
abracadabra
Sample Output 3Copy
Copy
54