CF1276F.Asterisk Substrings
NOI/NOI+/CTSC
通过率:0%
时间限制:5.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Consider a string s of n lowercase English letters. Let ti be the string obtained by replacing the i-th character of s with an asterisk character *. For example, when s=abc, we have t1=∗bc, t2=a∗c, and t3=ab∗.
Given a string s, count the number of distinct strings of lowercase English letters and asterisks that occur as a substring of at least one string in the set s,t1,…,tn. The empty string should be counted.
Note that *'s are just characters and do not play any special role as in, for example, regex matching.
考虑一个由 n 个小写英文字母组成的字符串 s。令 ti 表示将 s 的第 i 个字符替换为星号字符 * 后所得的字符串。例如,当 s=abc 时,有 t1=∗bc、t2=a∗c 和 t3=ab∗。
给定字符串 s,统计在集合 {s,t1,…,tn} 中至少一个字符串中作为子串出现的不同字符串(由小写英文字母和星号组成)的个数。空字符串应被计入。
注意:* 仅被视为普通字符,不具有任何特殊含义(例如,在正则表达式匹配中那样的通配功能)。
输入格式
The only line contains a string s of n lowercase English letters (1≤n≤105).
唯一一行包含一个由 n 个小写英文字母组成的字符串 s(1≤n≤105)。
输出格式
Print a single integer — the number of distinct strings of s,t1,…,tn.
输出一个整数——字符串 s,t1,…,tn 中互不相同的字符串的个数。
输入输出样例
输入#1
abc
输出#1
15
说明/提示
For the sample case, the distinct substrings are (empty string), a, b, c, *, ab, a*, bc, b*, *b, *c, abc, ab*, a*c, *bc.
对于样例,不同的子串有(空字符串)、a、b、c、*、ab、a*、bc、b*、*b、*c、abc、ab*、a*c、*bc。
输入解题思路,AI测评打分。不知道怎么写?