周期串~~
2015-12-28 20:05
106 查看
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int i; char word[100]; scanf("%s",word); int len=strlen(word); for(i=1;i<=len;i++) { if(len%i==0) { int ok=1,j; for(j=i;j<len;j++) { if(word[j]!=word[j%i]) { ok=0;break; } } if(ok) { printf("%d\n",i); break; } } } return 0; }
相关文章推荐
- Python---list
- Python---set
- Python脚本基础
- 二十三种设计模式
- socket错误代码对照
- c/c++里的 堆区 栈区 静态区 文字常量区 程序代码区(二)
- Python---dict
- Python---dict
- linux shell 中"2>&1"含义
- GMM算法k-means算法的比较
- perl与json
- Multiple-instance learning 和 Multi-label classification
- hibernate search 相关网址
- linux各种命令
- 深入分析JavaWeb Item36 -- 过滤器Filter高级应用
- NJUPT GNU/Linux编程 实验1-6总结(走过的坑)
- uva10382
- 四则混合运算
- 数据库入门学习总结1
- 编程练习 15.12.15~15.12.22