prompt string | response string |
|---|---|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | x=input()
time=1
x=list(x)
j=str(x)
v=x[len(x)-1]
while True:
v=x[len(x)-1]
q=1
z=2
while z<=len(x):
x[len(x)-q]=x[len(x)-z]
q+=1
z+=1
x[0]=v
if str(x)==j:
break
else:
time+=1
print(time)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | n = raw_input()
lista1 =[]
lista2 =[]
for i in n:
lista1.append(i)
con = (len(lista1)*-1) + 1
for i in range(0,len(lista1)):
index = con
palabra = ""
for a in range(0,len(lista1)):
palabra = palabra + lista1[index]
index+=1
lista2.append(palabra)
con+=1
contador = 0;
lista2.sort()
try:
for a in range(0, len... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... |
s=raw_input()
mp={}
t = s
l = len(s)
for i in range(0, l):
tStr = s[l-i: l]+ s[0:l-i]
mp[tStr] = 1
print len(mp)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | stroka = input()
A = set()
for i in range(len(stroka)):
A.add(stroka)
stroka = stroka[-1]+stroka[:len(stroka)-1]
print(len(A)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Hongcow {
public static void main(String[] args){
String input;
Scanner sc = new Scanner(System.in);
Set<String> list = new HashSet<String>();
list.add(input = sc.nextLine());
int len = i... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
int main() {
char s[51];
scanf("%s", s);
int n = strlen(s);
int seen[51];
int i, j, k;
for (i = 0; i < n; i++) {
seen[i] = 0;
}
int count = 0;
for (i = 0; i < n; i++) {
if (!seen[i]) {
count++;
for (j = i + 1; j < n; j++) {
k = n;
int all_sa... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | a = raw_input()
n = len(a)
if n==1:
print 1
else:
for i in range(1,n):
if n%i == 0:
s = a[0:i]
for j in range(0,n,i):
if a[j:i+j] != s:
flag = False
c = n
break
else:
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=raw_input()
n=len(s)
t=s+s
for i in xrange(1,n+1):
if t[i:i+n]==s:
print i
break
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
char a[51][51];
int l, k;
cin >> s;
for (int i = 0; i <= 50; i++)
for (int j = 0; j <= 50; j++) a[i][j] = '0';
for (l = 0; s[l] != '\0'; l++)
;
for (int i = 0; i < l; i++) {
for (int j = 0, k = i; j < l; j++) {
a[j][k] ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = raw_input()
dis = set([s])
for i in xrange(len(s)):
s = s[-1] + s[:-1]
if s not in dis:
dis.add(s)
print len(dis) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | str = input()
cycle = set()
for i in range(0, len(str)):
cycle.add(str[i:] + str[:i])
print(len(cycle))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class A {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String in = br.readLine();
String[] a = new String[in.length()];
f... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = raw_input().strip()
lens = len(s)
x = set()
x.add(s)
for i in range(lens-1):
s = s[lens-1] + s[:lens-1]
x.add(s)
print len(x) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
bool isVowel(char x) {
if (x == 'u' || x == 'e' || x == 'o' || x == 'a' || x == 'i') {
return true;
} else
return false;
}
bool gcd(long long int a, long long int b) {
if (a % b == 0)
return b;
else
return gcd(b % a, a);
}
bool isPrime(long long int ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.TreeSet;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author zodiacLeo
*/
public class Main
{
public static void main(String[] a... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, b;
cin >> a;
int len, res;
b = a;
len = a.length();
a += a;
a.erase(0, 1);
res = a.find(b);
cout << res + 1;
return 0;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
import java.io.*;
public class HongcowCyclicShift {
public static void main(String[] args) throws Exception {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
String line = in.next();
int len = line.length();
Set<St... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> g;
g.insert(s);
int n = s.size();
for (int k = 0; k < s.size(); k++) {
string s1 = "";
s1 += s[n - 1];
for (int i = 0; i < s.size() - 1; i++) {
s1 += s[i];
}
s = s1;
g.insert(s);
}
co... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> sz;
sz.insert(s);
for (int i = 0; i < s.size(); ++i) {
string temp(s);
temp[0] = s[s.size() - 1];
for (int j = 0; j < s.size() - 1; ++j) {
temp[j + 1] = s[j];
}
sz.insert(temp);
s = temp;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
c=''
d=0
s1=s
while(c!=s1):
d+=1
c=s[1:]+s[:1]
s=c
print(d) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
ans = {s}
for i in range(len(s) + 3):
s = s[1:] + s[0]
ans.add(s)
print(len(ans))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
se = set()
for _ in range(51):
se.add(s)
sl = s[1:]
s = sl + s[0]
print(len(se)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
set1={s}
for i in range(0,len(s)):
s=s[-1]+s[0:-1]
set1.add(s)
print(len(set1)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | def solve():
global s
x = set([s])
for i in range(len(s)):
s = s[-1] + s[:-1]
x.add(s)
return len(x)
def main():
global s
s = input()
print(solve())
main()
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
variants = [s]
for i in range(1,len(s)):
if s[i:]+s[:i] not in variants: variants += [s[i:]+s[:i]]
print(len(variants)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s[100];
int i, j, count = 0, num = 0;
cin >> s[0];
for (i = 0; i < s[0].length(); i++) {
s[i + 1] = s[i];
num = 0;
rotate(s[i + 1].rbegin(), s[i + 1].rbegin() + 1, s[i + 1].rend());
}
for (i = 0; i < s[0].length(); i++) {
num ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | def main():
dict = {}
s = input()
f = len(s)
s = s*f
for i in range(f):
dict[s[i:i+f]] = 1
print(len(dict))
main() |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | a, b = input(), []
for i in range(len(a)):
if a not in b:
b.append(a)
a = a[1:] + a[0]
print(len(b)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
ans = set()
for l in range(len(s)):
t = s[l:] + s[:l]
ans.add(t)
print(len(ans)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
l = []
for i in s:
l.append(i)
t = set()
for i in range(len(s)):
f = ''
for j in l:
f += j
t.add(f)
c = l.pop(0)
l.append(c)
#print(f)
print(len(t)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string c, s;
cin >> c;
s = c + c;
cout << (s.find(c, 1));
return 0;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | word=input()
line=[]
for i in range(len(word)):
if word not in line:
line=line+[word]
word=word[-1]+word[ :-1]
print(len(line))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | keke = dict()
ans = 0
s = input().strip()
for i in range(0, len(s)):
if not s in keke:
keke[s] = 1
ans+= 1
s = s[-1] + s[:-1]
print(ans) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | # w=list(map(int,input().split()
w= input()
differen = []
differen.append(w)
for a in w:
w=w[len(w)-1]+w
w=w[:len(w)-1]
differen.append(w) if w not in differen else True
print(len(differen))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
cnt = 1
l = len(s)
p = 1
d = []
d.append(s)
while p < l:
n = s[-1] + s[:l-1]
if n not in d:
d.append(n)
s = n
p += 1
print(len(d))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
int main() {
char str[110], arr[110][110];
memset(str, 0, sizeof(str)), memset(arr, 0, sizeof(arr));
while (scanf("%s", str) != EOF) {
strcpy(arr[0], str);
int i, j, flag = 1, n = strlen(str), num = 1;
char temp;
int t = n;
for (j = 1; j < n; j++) {
temp = str[n ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
S=set()
for _ in range(len(s)):
S|={s}
s=s[1:]+s[0]
print(len(S))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
a = []
for i in range(len(s)):
s = s[-1] + s[:-1]
a.append(s)
a = set(a)
print(len(a))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | a = input()
t = a
r1 = len(a)
for i in range(len(a)):
a = a[r1-1] + a[0:r1-1]
if a == t:
break
print(i+1)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
import java.lang.*;
import java.util.ArrayList.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
void solve(InputReader in,PrintWriter out)throws IndexOutOfBoundsException
{
String s=in.next();
int cnt=0;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, a, l, w, z, ss, t, k, e, c, total, nnn, yes,
mx = 531, mn = -1, r, xx, yy, last, cas;
map<string, int> wow;
int main() {
string s;
cin >> s;
wow[s] = 1;
x = 1;
l = s.size();
for (int i = 0; i < l; i++) {
char te = s[l - 1];
for ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
l1=[]
count=1
l1.append(s)
for i in range(0,len(s)-1):
s=s[1:]+s[:1]
if s not in l1:
count+=1
l1.append(s)
print(count) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
cin >> str;
set<string> st;
int m = str.size();
while (m--) {
char temp = str[str.size() - 1];
for (int i = str.size() - 1; i > 0; i--) str[i] = str[i - 1];
str[0] = temp;
st.insert(str);
}
cout << st.size() << endl;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
s = raw_input()
a = set()
for i in xrange(len(s)):
s = s[-1] + s[0:len(s)-1]
a.add(s)
print len(a)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
string s, a;
int main() {
cin >> s;
a = s;
s.append(s);
cout << s.find(a, 1) << endl;
return 0;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = raw_input()
n = len(s)
res = set()
for i in range(n):
res.add(s)
s = s[-1:] + s[:-1]
print len(res)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
public class Cyclicshift {
public static void main(String[] args) {
TreeSet <String> t=new TreeSet<>();
String s;
Scanner sc=new Scanner(System.in);
s=sc.next();
t.add(s);
for(int i=1;i<s.length();i++)
{
String e=(s.substring(s.length()... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
if(s.length() == 1) {
System.out.println("1");
} else {
Set<String> str = new HashSet<>();
StringBuilder curr = new StringBuilder(s);
for(int i = ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
arr = [s]
length = len(s)
count = 1
for i in range(1,length):
s = s[-1] + s[:length-1]
if s not in arr:
count += 1
arr.append(s)
print(count) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan =new Scanner(System.in);
String s=scan.next();
String t=s;
int l=s.length();
String[] arr=new String[l];
int re=1;
arr[0]=s;
int ans=l... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
string s;
int ans = 0;
char f;
int main() {
cin >> s;
string b = s;
f = s[0];
int d = s[s.size() - 1];
for (int i = s.size() - 1; i >= 0; i--) {
s[i] = s[i - 1];
}
s[0] = d;
ans++;
while (b != s) {
int d = s[s.size() - 1];
for (int i = s.size()... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | print (lambda s: len(set(s[i:] + s[:i] for i in range(len(s)))))(raw_input()) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | string = input()
words = []
count = 0
for i in range(len(string)):
if string not in words:
count += 1
words.append(string)
string = string[1:] + string[0]
print(count)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, cnt;
string s, cal, kcal;
bool ok = false, mtest = false;
char ch;
deque<char> A, B;
void solve() {
cin >> s;
for (int i = 0; i < (int)s.size(); ++i) {
A.push_back(s[i]);
B.push_back(s[i]);
}
while (1) {
ch = A[A.size() - 1];
A.... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | word=list(input())
index=0
m=[]
k=[]
num=0
while index<len(word):
m=m+[word.pop(-1)]
word=m+word
new="".join(word)
if new not in k:
num+=1
k=k+[new]
m=[]
index+=1
print(num) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
p = s
a = []
j = 0
for i in range(len(s)):
p = p[1:] + p[0]
if p not in a:
a.append(p)
print(len(a)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... |
import java.util.Scanner;
import java.util.TreeSet;
public class HongcowLearnsTheCyclicShift {
private static void shift(char[] c) {
char temp = c[1];
int n = c.length;
c[1] = c[0];
for (int i = 2; i < n; i++) {
char t = c[i];
c[i] = temp;
temp = t;
}
c[0] = temp;
}
public static vo... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
const int Z = (int)1e5 + 123;
const int inf = (int)2e9 + 123;
const long long llinf = (long long)2e18 + 123;
const double PI = acos(-1.0);
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
set<list<char>> a;
list<char> s;
string t;
cin >> t;
int... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
char a[51][52];
int n, cont;
bool fr[51];
void formare(int p) {
a[p][0] = a[p - 1][n - 1];
for (int i = 0; i < n - 1; ++i) a[p][i + 1] = a[p - 1][i];
}
void verificare() {
for (int i = 1; i <= n; ++i)
for (int j = i + 1; j <= n; ++j)
if (strcmp(a[i], a[j]) =... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.*;
import java.util.*;
import java.util.regex.*;
public class vk18
{
public static void main(String[]stp) throws Exception
{
Scanner scan=new Scanner(System.in);
//BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//String []s;
int i;
S... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | a=input()
from collections import defaultdict
dict=defaultdict(int)
for i in range(len(a)):
dict[a]=1
a=a[1:]+a[:1]
print(len(dict)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | n=str(input())
s=set()
for i in range(len(n)):
s.add(n[i:]+n[:i])
print(len(s))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
string a[51];
int main() {
string s;
cin >> s;
int pos = 0;
for (int i = 0; i < s.size(); i++) {
bool ok = true;
for (int z = 0; z < pos; z++) {
if (a[z] == s) {
ok = false;
break;
}
}
if (ok == true) {
a[pos] = s;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | from sys import stdin, stdout
import math
s = stdin.readline()[:-1]
a = set()
a.add(s)
for i in range(len(s)):
s = s[1:] + s[0]
a.add(s)
print(len(a))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... |
import java.util.Arrays;
import java.util.Scanner;
/**
*
* @author fffee
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
String in = sc.nextLine();
int ans = in.length();
char a[][]= new char [ans][ans];
for ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.HashMap;
import java.util.Scanner;
public class quesA {
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
String str = s.next();
HashMap<String, Boolean> map = new HashMap<>();
map.put(str, true);
String temp = str;
for(int i=str.length()-1; i>=0;i--)
{
s... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | str=input()
st=set()
l=len(str)
for i in range(l):
if str not in st:
st.add(str)
str = str[l-1]+str[0:l-1]
print(len(st))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string str, t;
cin >> str;
t = str;
t += str;
t.erase(0, 1);
cout << t.find(str) + 1;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
string s, a[54], sub, ps;
int br = 0;
cin >> s;
unsigned int len = s.size();
for (unsigned int i = 0; i < len; i++) {
a[i] = s;
sub = s.substr(0, len - 1);
ps = s.substr(len - 1, len);
s = ps + sub;
}
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... |
if __name__== "__main__":
s=raw_input()
a=set()
a.add(s)
for i in range(len(s)-1):
a.add(s[i+1:]+s[0:i+1])
print len(a) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
string a;
vector<string> v;
cin >> a;
int t = 1;
for (int i = 0; i < a.length(); i++) {
char c = a[a.length() - 1];
a.erase(a.length() - 1, 1);
a.insert(a.begin(), c);
bool b = 0;
for (int j = 0; j < v.si... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
ansset = []
for i in range(len(s)):
l = s[:len(s)-1]
r = s[len(s)-1]
s = r+l
ansset.append(s)
ans = set(ansset)
print(len(ans)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int zoma, t, i, z = 1;
string s, k;
int main() {
cin >> s;
zoma = s.size();
string n[zoma];
for (i = 0; i < zoma; i++) {
k = s[zoma - 1];
s.insert(0, k);
s.erase(zoma, 1);
n[i] = s;
}
sort(n, n + zoma);
for (i = 0; i < zoma - 1; i++) {
if (... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | word = input()
words = set()
words.add(word)
for i, letter in enumerate(word):
i += 1
new_word = word[-i:] + word[:-i]
words.add(new_word)
print(len(words)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
void read(char& a) {
do scanf("%c", &a);
while (isspace(a));
}
void write(const char& a) { printf("%c", a); }
char BUF[1234560];
void read(string& a) {
scanf("%s", BUF);
a = string(BUF);
}
void write(const string& a) { printf("%s", a.c_str()); }
void read(int& a) { ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... |
/**
* Author:-Harsh Chaudhari
* College:-DA-IICT
*/
import java.util.*;
import java.io.*;
public class A745 {
public static void main(String[] args) {
InputReader s = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
/*My code starts here.*/
HashSet <String>set = new HashSet<Stri... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
public static PrintWriter out;
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
String s = sc.nextLine();
StringBu... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | comb = []
string = input()
comb.append(string)
new_string = string
while True:
new_string = new_string[-1] + new_string[0:-1]
if new_string not in comb:
comb.append(new_string)
else:
break
print(len(comb))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
import java.io.*;
import java.lang.*;
public class A745{
private static long mod = 1000000007;
public static void main(String[] args) {
InputReader in=new InputReader(System.in);
PrintWriter pw=new PrintWriter(System.out);
String s=in.nextLine();
int n=s.length();
boolean flag=true;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
getline(cin, s);
set<string> words;
for (int i = 0; i < s.size(); ++i) {
words.insert(s);
s = s[s.size() - 1] + s.substr(0, s.size() - 1);
}
cout << words.size();
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
ArrayList<String> allStrs = new ArrayList<String>();
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import math as mt
import sys,string,bisect
input=sys.stdin.readline
from collections import deque,defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())
n=input().strip()
s=set([])
for i in range(len(n)):
d=n[-1]+n[:-1:]
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
sss=set()
for i in range(len(s)):
ss=s[i:]+s[:i]
sss.add(ss)
print(len(sss))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = raw_input()
m = set()
for i in range(len(s)):
m.add(s[-i:] + s[:-i])
print len(m)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string t;
cin >> t;
string s = t + t;
cout << s.find(t, 1);
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
strings = [s, ]
count = 1
le = len(s)
for i in range(le):
ch = s[-1]
s = ch + s[0:le-1]
if not(s in strings):
count += 1
strings.append(s)
print(count)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | a=list(input())
d=[a]
for x in range(len(a)-1):
b=a.copy()
c=b[-1]
b.pop()
b.insert(0,c)
if b not in d:
d.append(b)
a=b
print(len(d)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
map<string, int> a;
for (int i = 1; i <= 60; i++) {
a[s]++;
s += s[0];
s.erase(s.begin());
}
cout << a.size();
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.AbstractSet;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.AbstractCollection;
import java.util.Map;
import java.io.OutputStreamWriter;
import java.util.NoS... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | def main():
s = input(); length = len(s); s += s; was = set()
for i in range(length): was.add(s[i:length+i])
print(len(was))
main() |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | st = input()
dic = {}
l = len(st)
for i in range(l, 0, -1):
if st[i:]+st[:i] in dic:
pass
else:
dic[st[i:]+st[:i]]=1
print(sum(dic.values())) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | l=list(input())
x=[]
y=l[:]
for i in range(len(l)):
y = list(y[-1])+y[:-1]
x.append("".join(y))
print(len(set(x))) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
vector<string> v;
int main() {
string s;
cin >> s;
v.push_back(s);
int cnt = 0;
for (int i = 1; i < s.length(); i++) {
char tmp = s[s.length() - 1];
for (int i = s.length() - 1; i > 0; i--) {
s[i] = s[i - 1];
}
s[0] = tmp;
int f = 1;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input();print(len({s[i:]+s[:i] for i in range(len(s))})) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> se;
for (int i = 0; i < s.length(); i++) {
se.insert(s);
char l = s.back();
s.pop_back();
reverse(s.begin(), s.end());
s.push_back(l);
reverse(s.begin(), s.end());
}
cout << se.size() << endl;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
long long m, cnt, mx, n, x, h, sum, y, ans, z, res, q, l, o, n1, g, mn, c, i,
mxx;
pair<int, int> p[1001];
string s, s1, s2;
vector<string> v, v1, v2;
set<string> st;
set<int> it;
deque<int> d, d1, d2;
char a, b;
map<string, int> mp;
int main() {
cin >> s;
v.push_ba... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | x = input()
lst = []
for i in range(len(x)):
if x[i:]+x[:i] not in lst:
# print(x[i:]+x[:i])
lst.append(x[i:]+x[:i])
print(len(lst)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | # -*- coding: utf-8 -*-
# @Author: Krishna
# @Date: 2016-12-17 22:08:21
# @Last Modified by: Krishna
# @Last Modified time: 2016-12-17 22:11:50
st = raw_input()
ll = len(st)
cnt = set()
for i in range(ll):
st = st[-1] + st[:-1]
cnt.add(st)
print len(cnt) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | def main():
s = input()
k = set()
for i in range(len(s)):
k.add(s[i:] + s[:i])
print(len(k))
main() |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
cin >> s;
map<string, int> mp;
int cnt = 0, i;
for (i = 0; i < s.length(); i++) {
if (mp[s] == 0) {
mp[s]++;
cnt++;
}
t = s.back();
s.pop_back();
t.append(s);
s = t;
}
cout << cnt;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.