I(cd1682)
  W79oLdECuAdO 2023年11月12日 17 0


#include<stdio.h>
#include<string.h>

int main()
{
	int i,j,k;
	int n;
	int t;
	char go[10000];
	scanf("%d",&t);
	while (t--)
	{
		scanf("%s",go);
		n=strlen(go);
		int ans=1;
		for (i=1;i<n;i++)
		{
			for (j=0;j<n;j++)
			{
				if (go[j]!=go[(i+j)%n])
					break;
			}
			if (j==n)
				ans++;
		}
		printf("%d\n",ans);
	}
}


I

Time Limit: 1000 ms Memory Limit: 65536 kB Solved: 109 Tried: 171


Description



Given a string A with length N.

A0 A1 A2 A3 ...... AN-1

S(0) = A0 A1 A2 A3 ...... AN-2 AN-1
S(1) = A1 A2 A3 ...... AN-2 AN-1 A0
S(2) = A2 A3 ...... AN-2 AN-1 A0 A1

......

S(N-1) = AN-1 A0 A1 A2 A3 ...... AN-2

Windy want to know how many i in [0, N - 1] that make S(i) euqal to S(0).
Can you find it for Windy?



Input



The first line of input is the number of test case.
For each test case,
there is only one line contains a string A.
String A only contains lowercase letter ('a'--'z').
1 <= N <= 1000



Output



For each test case output the answer on a single line.



Simple Input



3
aaa
abab
aba



Simple Output



3
2
1



Source





【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月12日 0

暂无评论

推荐阅读
  W79oLdECuAdO   2023年11月12日   24   0   0 inputoutput#include游戏测试
  W79oLdECuAdO   2023年11月12日   24   0   0 input存储output工具测试
  W79oLdECuAdO   2023年11月12日   18   0   0 inputoutputeachstringgo
  xWYnr39PTA9E   2023年11月19日   17   0   0 go
  W79oLdECuAdO   2023年11月12日   21   0   0 inputoutputeachintegerMemory
W79oLdECuAdO
作者其他文章 更多