103471: [Atcoder]ABC347 B - Substring

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:12 Solved:0

Description

Score: $200$ points

Problem Statement

You are given a string $S$ consisting of lowercase English letters. How many different non-empty substrings does $S$ have?

A substring is a contiguous subsequence. For example, xxx is a substring of yxxxy but not of xxyxx.

Constraints

  • $S$ is a string of length between $1$ and $100$, inclusive, consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

$S$

Output

Print the answer.


Sample Input 1

yay

Sample Output 1

5

$S$ has the following five different non-empty substrings:

  • a
  • y
  • ay
  • ya
  • yay

Sample Input 2

aababc

Sample Output 2

17

Sample Input 3

abracadabra

Sample Output 3

54

Input

Output

分数:200分

问题描述

给定一个由小写英文字母组成的字符串$S$。$S$有多少个不同的非空子串?

子串是一个连续的子序列。例如,xxxyxxxy的子串,但不是xxyxx的子串。

约束条件

  • $S$是一个长度在$1$到$100$之间的字符串,由小写英文字母组成。

输入

输入数据通过标准输入给出如下格式:

$S$

输出

打印答案。


样例输入1

yay

样例输出1

5

$S$有以下五个不同的非空子串:

  • a
  • y
  • ay
  • ya
  • yay

样例输入2

aababc

样例输出2

17

样例输入3

abracadabra

样例输出3

54

加入题单

算法标签: