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... |
s=raw_input()
dt={}
count=0
for i in range(len(s)):
v=s[len(s)-1]
v+=s[:len(s)-1]
#print(v)
if v not in dt:
dt[v]=1
count+=1;
s=v
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... | n=str(raw_input(''))
a=[n]
for i in range(1,len(n)):
if str(n[i:len(n)]+n[0:i]) not in a:
a+=[str(n[i:len(n)]+n[0:i]) ]
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.*;
public class Solution {
private static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
char[] s = sc.next().toCharArray();
Set<String> set = new HashSet<>();
for (int i = 0; i < s.length; i++) {
char[] x = new char[s.length];
System.arrayc... |
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 sys
from sys import stdin
from sets import Set
s = stdin.readline().strip()
words = Set([s])
for i in range(len(s) - 1):
s = s[-1] + s[:-1]
words.add(s)
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... | //package round385;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.*;
public class A {
InputStream is;
PrintWriter out;
String INP... |
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();
boolea... |
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 os
import sys
from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
de... |
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<vector<char>> V;
char str[(55)];
int N;
int main() {
scanf(" %s", str);
N = (int)strlen(str);
for (int i = 0; i < N; i++) {
V.push_back(vector<char>());
vector<char> &Q = V.back();
for (int j = i; j < N; j++) Q.push_back(str[j]);
for (int j = 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 = input()
A = []
for i in range(len(s)):
A.append(s)
s = s[-1] + s[:-1]
q = set(A)
q = list(q)
print(len(q))
|
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=list(raw_input())
l=[]
s1="".join(s)
while s1 not in l:
l.append(s1)
s.insert(0,s.pop(len(s)-1))
s1="".join(s)
print len(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;
map<string, int> M;
int main() {
string s;
cin >> s;
int N = s.size();
s = s + s;
for (int i = 0; i < N; i++) {
string ss;
for (int j = 0; j < N; j++) ss.push_back(s[i + j]);
M[ss]++;
}
cout << M.size();
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string s;
cin >> s;
set<string> st;
st.insert(s);
string s1 = s, s2;
for (long long int i = 0; i < s.size(); i++) {
string s2;
s2 += s1[s1.size() - 1];
s2 += s1.subst... |
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.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class HongcowLearnsTheCyclicShift {
public static void main(String[] args) {
try
{
BufferedReader reader = new BufferedReader(new 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>
using namespace std;
const int N = 60;
string s[N];
int n, ans;
int main() {
cin >> s[0];
n = s[0].length() - 1;
for (int i = 1, nn = int(n); i <= nn; ++i) {
s[i] += s[i - 1][n];
for (int j = 0, nn = int(n - 1); j <= nn; ++j) s[i] += s[i - 1][j];
}
sort(s, s + n + 1);
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;
string s, ss, sss;
map<string, int> mm;
int main() {
cin >> s;
int ans = 0;
for (int i = 0; i < s.size(); i++) {
ss.clear();
for (int k = i; k < s.size(); k++) ss += s[k];
for (int k = 0; k < i; k++) ss += s[k];
if (mm[ss] == 0) {
ans++;
mm... |
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 principal_period(s):
i = (s+s).find(s, 1, -1)
return None if i == -1 else s[:i]
s = input()
a = principal_period(s)
if a is not None:
print(len(a))
elif a is None:
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... | import math,sys,re,itertools,pprint,collections,copy
rs,ri,rai,raf=input,lambda:int(input()),lambda:list(map(int, input().split())),lambda:list(map(float, input().split()))
t = input()
res = {t}
for i in range(52):
t = t[-1] + t[:-1]
res.add(t)
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... | s = raw_input()
d = {s : True}
if len(s) == 1:
print 1
exit()
for i in range(len(s)):
s = s[len(s) - 1] + s[:len(s) - 1]
d[s] = True
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... | s = list(input())
aux = [0]*len(s)
for i in range(len(s)):
aux[i] = s[i]
ans = 0
for i in range(len(s)):
s.insert(0, s[-1])
del s[-1]
ans += 1
if (s == aux):
print(ans)
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... | s=input()
test=s
count=1
for i in range(len(test)):
test=test[1:]+test[0]
if test !=s:
count+=1
else:
break
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.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
/**
* @author entick
*/
public final class Main {
private void solve() {
String s = in.nextLine();
Set<String> set = new HashSet<>();
for (int i=0;i<=s.length();i++){
set.add(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() {
int s, i, x = 0, k, j, t = 0, n;
char a[51][51], b[51];
cin >> a[0];
s = strlen(a[0]);
for (i = 1; i < s; i++) {
a[i][0] = a[i - 1][s - 1];
b[0] = a[i][0];
for (j = 1; j < s; j++) {
a[i][j] = a[i - 1][j - 1];
b[j] = a[i][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... | s = input()
print(len(set(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>
const int MAXINT = 2147483640;
const long long MAXLL = 9223372036854775800LL;
const long long MAXN = 1000000;
using namespace std;
map<string, long long> mp;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
string s, s1;
long long i, res = 0;
cin >> s;
i = s.size() - 1;
s1 =... |
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 = raw_input()
ans = set([word])
new_word = word
for i in xrange(len(word)):
new_word = new_word[-1] + new_word[:-1]
ans.add(new_word)
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 = len(s)
ks = []
for i in range(1,l):
if l%i==0:
ks.append(i)
res = len(s)
for k in ks:
if s[:k]*(int(len(s)/k))==s:
res = k
break
print(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.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public clas... |
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()
d = {}
n = len(s)
counter = 0
for i in range(n):
s2 = ""
for j in range(n):
s2 += s[(i+j)%n]
if s2 not in d:
d[s2] = 1
counter += 1
# print(s2)
print(counter) |
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;
Set<String> list = new HashSet<String>();
list.add(input = (new Scanner(System.in)).nextLine());
for(int i=0; i<input.length()-1; 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()
l = []
n = len(s)
for i in range(n):
l.append(s[i+1:n]+s[:i+1])
print(len(list(set(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... | x=input()
y=x
i=0
a=[]
a.append(y)
while i<len(x):
y=y[len(x)-1]+y[0:len(x)-1]
a.append(y)
i+=1
print(len(set(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... | # print("Input the string")
st = input()
theset = set()
theset.add(st)
for i in range(len(st)):
st = st[-1] + st[0:len(st)-1]
theset.add(st)
print(len(theset))
|
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(set([s[i:] + s[:i] for i in range(len(s),0,-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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
public class CF745A {
public static void main(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... | s=raw_input()
d={}
for i in xrange(len(s)):
d[s]=True
s=s[1:]+s[0]
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;
static char str[1000];
static char gp[10000][1000];
int main() {
int t, i, j, l, k, n;
scanf("%s", str);
n = strlen(str);
for (i = 0; i < n; i++) gp[0][i] = str[i];
for (i = 1; i < n; i++) {
gp[i][0] = gp[i - 1][n - 1];
for (j = 1; j < n; j++) {
gp[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()
x = set()
length = len(s)
for i in range(length):
ss = s[i:] + s[:i]
x.add(ss)
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;
int main() {
set<string> s;
string a, b;
cin >> a;
s.insert(a);
for (int i = 0; i < a.size() - 1; i++) {
b = "";
for (int j = 0; j < a.size() - 1; j++) b = b + a[j];
b = a[a.size() - 1] + b;
s.insert(b);
a = b;
}
cout << s.size();
return ... |
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... | big_lst = []
s = input()
big_lst.append(s)
len_s = len(s)
for i in range(len_s):
# print(s)
s = s[-1] + s[:-1]
if s not in big_lst:
big_lst.append(s)
print(len(big_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... | if __name__ == '__main__':
s = str(input())
l = set()
n = len(s)
for i in range(n):
l.add(s[i:] + s[:i])
print(len(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... | s = input()
s_init, s_new = s, s
i = 0
while i < len(s):
s_new = s[-1] + s[:-1]
i += 1
if s_new == s_init:
break
s = s_new
print(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>
using namespace std;
map<string, int> mp;
string s;
int main() {
cin >> s;
mp.clear();
int len = s.size();
mp[s] = 1;
for (int i = 2; i <= len; i++) {
char c = s[len - 1];
for (int j = len - 1; j > 0; j--) s[j] = s[j - 1];
s[0] = c;
mp[s] = 1;
}
printf("%d\n", mp.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... |
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner ab = new Scanner(System.in);
StringBuffer s = new StringBuffer(ab.next());
ArrayList<String> al = new ArrayList<>();
al.add(s.toString());
while (tr... |
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 shift(string &s) {
char c = s[0];
int N = s.size() - 1;
for (int i = 0; i < N; ++i) {
s[i] = s[i + 1];
}
s[N] = c;
}
int main() {
set<string> s;
string in;
cin >> in;
s.emplace(in);
for (int i = 0; i < (int)in.size(); ++i) {
shift(in);
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... | t=input()
#find the longest common substring
l=len(t)
f=0
for i in range(1,(l//2)+1):
if l%i==0:
c=l//i
if t == c * t[:l//c]:
print(i)
f=1
break
if f==0:
print(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... | import java.util.HashSet;
import java.util.Scanner;
public class Main {
static HashSet<String> hs;
public static void main(String[] args) {
Scanner input =new Scanner(System.in);
String s =input.next();
int len =s.length();
hs=new HashSet<String>();
hs.add(s);
String newstr=s;
for(int i=0;i<len-1;++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 = raw_input()
ans = set()
for i in range(len(s)):
ans.add(s[i:] + s[0:i])
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... | # You lost the game.
s = str(input())
n = len(s)
L = [s]
def ok(L,s):
for x in L:
if x == s:
return 0
return 1
for i in range(n):
s = s[1:]+s[0]
if ok(L,s):
L += [s]
print(len(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;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
string toBin(long long a) {
string res = "";
while (a) {
res += char((a & 1) + '0');
a >>= 1;
}
reverse(res.begin(), res.end());
return res;
}
const int mod = 1e9 +... |
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 s[55][55];
int n, ans = 1;
int main() {
scanf("%s", s[1]);
n = strlen(s[1]);
for (int i = 2; i <= n; i++) {
s[i][0] = s[i - 1][n - 1];
for (int j = 0; j < n - 1; j++) s[i][j + 1] = s[i - 1][j];
for (int j = 1; j < i; j++)
if (strcmp(s[i], s[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... | n=input()
b=n[-1]+n[:len(n)-1]
a=0
while(b!=n):
b=b[-1]+b[:len(b)-1]
# print(b)
a+=1
print(a+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... | st=raw_input()
st2=st+st
ans=st2.find(st,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... | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class TestClass {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static Space... |
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):
n = len(s)
se = set()
for i in range(n):
se.add(s[i:] + s[:i])
return len(se)
print(main(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... | s = raw_input()
m = []
for i in range(len(s)):
t = []
t.append(s[len(s)-1])
for j in range(len(s) - 1):
t.append(s[j])
stri = ''.join(t)
m.append(stri)
a = set(m)
s = t
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 l, cnt, vv, v[100], ans;
char s[100], ss[100][100];
int main() {
scanf("%s", s);
l = strlen(s);
for (int i = 0; i < l; i++) {
cnt = 0;
for (int j = i; j < l + i; j++) {
if (j >= l)
ss[i][cnt] = s[j - l];
else
ss[i][cnt] = s[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 sys
s = input()
def foo(x) :
global s
y = x[-1] + x[:len(x)-1]
if s == y : return 1
return foo(y) + 1
print(foo(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... | #code
s = str(input())
lis = [s,]
for i in range(1, len(s)):
lis.append(s[i:]+s[0:i])
ans = len(set(lis))
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... | #include <bits/stdc++.h>
using namespace std;
int n;
char word[555];
vector<int> data;
bool mycmp(const int &ls, const int &rs) {
for (int i = 0; i < n; i++) {
char lsv = word[(ls + i) % n];
char rsv = word[(rs + i) % n];
if (lsv == rsv) continue;
return (lsv < rsv);
}
return (ls < rs);
}
bool sam... |
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;
int l = s.length();
map<string, int> mp;
for (int i = 0; i < l; i++) {
mp[s]++;
char x = s[l - 1];
for (int i = l - 1; i > 0; i--) {
s[i] = s[i - 1];
}
s[0] = x;
}
cout << mp.size();
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.Scanner;
public class Task1
{
public static void main(String[] args)
{
Task1 t = new Task1();
Problem p = t.new Problem();
Scanner in = new Scanner(System.in);
String s = in.next();
System.out.println(p.Solve(s));
}
public class Problem
{
public Problem()
{
}
p... |
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 re
import sys
import time
def read(t=None):
string = raw_input()
return string if t is None else [t(x) for x in string.split()]
def cleft(s):
a = [s[-1]]
a += s[:-1]
return a
def solve():
s = list(read())
n = len(s)
res = []
res.append("".join(s))
for i in range(n):
s = cleft(s)
res.append("".... |
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 word;
while (cin >> word) {
map<string, bool> check;
int cnt = 0;
for (int a = 0; a < word.length(); a++) {
if (!check[word]) cnt++;
check[word] = true;
string ch = word.substr(word.length() - 1, 1);
word.pop_back(... |
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()
s.add(S)
for i in range(len(S)):
tmp = S[i:]+S[:i]
s.add(tmp)
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... | import java.util.*;
public class P745A {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String temp = s;
TreeSet<String> x = new TreeSet<>();
x.add(s);
int total = 1;
for (int i=1; i<s.length(); 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... | word = raw_input()
ans = set()
ans.add(word)
for i in range(1, len(word)):
word = word[-1] + word[0:-1]
ans.add(word)
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... |
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
HashSet<String> list = new HashSet<>();
fo... |
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
{
InputStream is;
PrintWriter out;
String OUTPUT = "7";
String POUTPUT = "";
String INPUT = "abba";
void solve()
{
char arr[] = ns().toCharArray();
int n = arr.length;
HashSet<String> hash = new HashSet<String>();
int count =1000;
... |
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 UIntType = unsigned long long int;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::string s;
std::cin >> s;
std::unordered_set<std::string> set;
std::list<char> chars(s.begin(), s.end());
for (std::size_t i = 0; i < s.size(); ++i) {
chars.empla... |
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 = raw_input()
n = len(string)
list = [string]
flag = False
for i in range(0, n):
tmp = string[n - 1] + string[0:n-1]
string = tmp
flag = True
for j in list:
if j == tmp:
flag = False
break
if flag:
list.append(tmp)
print len(list)
|
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... | linea = raw_input()
usados = [linea]
total = 1
for i in xrange(len(linea)-1):
linea = linea[1::]+linea[0]
if linea not in usados:
total += 1
usados.append(linea)
print total |
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()
a=[s]
for i in xrange(len(s)-1):
s=s[-1]+s[:len(s)-1:]
a.append(s)
print len(set(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... | def main():
s = input()
q = set()
q.add(s)
for i in range(len(s)):
s = s[1:] + s[0]
q.add(s)
print(len(q))
if __name__ == '__main__':
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()
a = set()
n = len(s)
s += s
for i in range(n):
a.add(s[i:n + i])
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() {
string s;
cin >> s;
string s1 = s;
int count = 0, n = s.size();
do {
char value = s[0];
s[0] = s[n - 1];
for (int i = 1; i < n; i++) {
swap(value, s[i]);
}
count++;
} while (s != s1);
cout << count;
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
char s[51][51];
cin >> s[0];
int l = strlen(s[0]);
int count = 1;
for (int i = 1; i <= l; i++) {
for (int j = 0; j < l - 1; j++) {
s[i][j + 1] = s[i - 1][j];
}
s[i][0] = s[i - 1][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... | n = input()
list = [n]
for i in range(len(n)-1):
n = n[-1] + n[:-1]
list.append(n)
print(len(set(list))) |
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 solve() {
string s, a = "", b;
cin >> s;
unordered_map<string, int> m;
m[s]++;
for (int i = s.length() - 1; i >= 0; i--) {
a += s[i];
b = a;
reverse(b.begin(), b.end());
m[b + s.substr(0, i)]++;
}
cout << m.size() << endl;
}
int 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... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int ans = 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... | from collections import defaultdict
s = input()
n = len(s)
d = defaultdict(int)
if n == 0:
print('0')
else:
for i in range(n):
d[s] += 1
s = s[-1] + s[:n-1]
print(len(d.keys()))
|
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... | spell = input()
s = set()
for i in range(len(spell)):
s.add( spell[ i : : ] + spell[ : 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... | s = raw_input()
arr = {}
for i in xrange (len(s)):
b = s[-1]
s = b + s[:-1]
arr [s] = 1
print len (arr)
|
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 -*-
# File : 745a.py
# Author : recurze
# Date : 15:58 08.12.2018
# Last Modified Date: 16:03 08.12.2018
s = str(raw_input())
n = len(s)
a = set()
for i in xrange(n):
a.add(s[i:]+s[:i])
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... | from collections import deque
string = raw_input()
deq = deque(string)
di = {}
count = 1
for i in xrange(len(string)):
di[tuple(deq)] = 1
deq.rotate(1)
if not di.has_key(tuple(deq)):
count+=1
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.util.*;
import java.io.*;
import java.math.*;
public class Circular{
public static void main(String[] args) {
MyScanner sc=new MyScanner();
String s=sc.next();
HashSet<String> hs=new HashSet<>();
hs.add(s);
String t=s;
do{
t=t.charAt(t.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... | #include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long infl = 9e18;
int main() {
ios_base::sync_with_stdio(0);
string s;
cin >> s;
set<string> se;
for (int i = 0; i < s.size(); i++) {
se.insert(s);
string c = "";
c += s.back();
s.pop_back();
s.insert(0, c);
}
... |
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.HashSet;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
*... |
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 s[100];
int n, ans;
int main() {
scanf("%s", s + 1);
n = strlen(s + 1);
for (int i = 1; i <= n; ++i) {
for (int j = i + 1; j <= n; ++j) {
for (int k = 0; k < n; ++k)
if (s[i + k > n ? i + k - n : i + k] !=
s[j + k > n ? j + k - n : 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... | #include <bits/stdc++.h>
using namespace std;
map<string, bool> was;
string s;
int ans;
int main() {
cin >> s;
for (int i = 0; i < s.size(); i++) {
char last = s[s.size() - 1];
if (!was[s]) ans++, was[s] = 1;
s.erase(s.size() - 1, 1);
s = last + s;
}
cout << 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... | a = input()
d = {a}
for i in range(len(a)):
a = a[-1]+a[0:-1]
d.add(a)
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... | s = input()
answers = set()
for i in range(len(s) + 1):
answers.add(s)
s = s[-1] + s[:len(s) - 1]
print(len(answers))
|
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()
sn = s
n = 1
while True:
sn = sn[-1] + sn[:-1]
if sn != s:
n += 1
else:
break
print(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... | import sys
s = sys.stdin.readline().strip()
n = len(s)
S = set([])
s = s+s
for i in xrange(n):
S.add(s[i:i+n])
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;
char s[105];
string ss[105];
int main() {
while (scanf("%s", s) != EOF) {
int n = strlen(s);
ss[0] = s;
for (int i = 1; i < n; i++) {
char c = s[n - 1];
for (int j = n - 1; j > 0; j--) {
s[j] = s[j - 1];
}
s[0] = c;
ss[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... | import re
word = input()
if len(word) >= 1 and len(word) <= 50 and re.match(r"[a-z]+", word):
result = []
for ind in range(0, len(word)):
word = word[-1] + word[0:-1]
result.append(word)
print(len(set(result)))
|
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()
count = 0
s1 = set()
while s not in s1:
count += 1
s1.add(s)
s = s[-1] + s[:-1]
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.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
public class Check2
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
... |
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, s;
int z = 0;
cin >> s;
t = s;
do {
++z;
t = t.substr(1, 100) + t[0];
} while (t != s);
cout << z;
}
|
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 makra() {
set<string> s;
string t;
cin >> t;
for (int i = 0; i < (int)t.length(); ++i) {
string k;
for (int j = 0; j < (int)t.length(); ++j) k += t[(i + j) % (int)t.length()];
s.insert(k);
}
cout << s.size() << "\n";
}
int main() {
ios::sync_w... |
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... | // package CF;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class A {
public static void ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.