Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include<stdio.h>
#include<string.h>
void cycle(char s[],int len)
{
char temp=s[len-1];
int i;
for(i=len-1;i>0;i--)
{
s[i]=s[i-1];
}
s[0]=temp;
}
int main(){
char s[51],orig[51];
int len,count=0;
scanf("%s",s);
len=strlen(s);
strcpy(orig,s);
do
{
cycle(s,len);
count++;
}
while(strcmp(orig,s));
printf("%d\n",count);
return 0;
}
📦 Looking for Codeforces Round 385 Div Problem Hongcow? Check the best deals on Amazon.
🛒 Shop Codeforces Round 385 Div Problem Hongcow on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.
Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#include<stdio.h>
#include<string.h>
void cycle(char s[],int len)
{
char temp=s[len-1];
int i;
for(i=len-1;i>0;i--)
{
s[i]=s[i-1];
}
s[0]=temp;
}
int main(){
char s[51],orig[51];
int len,count=0;
scanf("%s",s);
len=strlen(s);
strcpy(orig,s);
do
{
cycle(s,len);
count++;
}
while(strcmp(orig,s));
printf("%d\n",count);
return 0;
}
📦 Looking for Codeforces Round 385 Div Problem Hongcow? Check the best deals on Amazon.
🛒 Shop Codeforces Round 385 Div Problem Hongcow on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.