// source code from laekov for c0x17
#define PRID "bxjl"
#include <cstdio>
#include <cstring>
#include <algorithm> using namespace std; typedef long long dint; const int maxn = ;
const int mod = ; char a[maxn];
int n, m, ne[maxn], sz[maxn]; void preNext() {
ne[] = ;
for (int i = , j = ; i <= n; ++ i) {
for (; j && a[i] != a[j + ]; j = ne[j]);
if (a[i] == a[j + ] && j + < i) {
ne[i] = ++ j;
} else {
ne[i] = ;
}
}
memset(sz, , sizeof(sz));
for (int i = n; i; -- i) {
++ sz[i];
sz[ne[i]] += sz[i];
}
} int main(int argc, char* args[]) {
if (argc < || strcmp(args[], "-nf")) {
freopen(PRID ".in", "r", stdin);
freopen(PRID ".out", "w", stdout);
}
scanf("%s", a + );
n = strlen(a + );
preNext();
dint ans();
for (int i = ; i <= n; ++ i) {
ans += sz[i];
}
printf("%d\n", (int)(ans % mod));
}

最新文章

  1. HTML5 学习总结(五)——WebSocket与消息推送
  2. ios 防止按钮快速点击造成多次响应的避免方法。
  3. loadrunner写入数据到文件
  4. springMVC使用注解方式进行页面跳转
  5. [大牛翻译系列]Hadoop(17)MapReduce 文件处理:小文件
  6. linux vncserver配置
  7. bzoj1257
  8. asterisk错误排查
  9. TCP:三次握手、四次握手、backlog及其他
  10. npm 一条命令更换淘宝源
  11. poj 3696 The Luckiest Number
  12. Spring Boot web简介及原理 day04
  13. win10 WSL kali 下载源 --另外 恭喜马哥喜提博客
  14. c# EF code First生成数据库以及表
  15. zipkin 整合elastic
  16. P1378 油滴扩展 dfs回溯法
  17. CentOS 通过yum在线安装MySQL5.7
  18. Cartographer源码阅读(6):LocalTrajectoryBuilder和PoseExtrapolator
  19. nrf52832 SDK 15.3.0 Flash 操作
  20. linux_vim

热门文章

  1. 数据挖掘系列(5)使用mahout做海量数据关联规则挖掘
  2. angular实现了一个简单demo,angular-weibo-favorites
  3. 第十七章:jQuery类库
  4. NIO提升系统性能
  5. log4j2 使用说明
  6. opencv笔记6:角点检测
  7. [Unity 游戏设计的元素]
  8. java连接mysql(二)
  9. jQuery的查找
  10. Chrome浏览器插件