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... | import sys, math, string, fractions, functools, collections, copy
sys.setrecursionlimit(10**7)
RI=lambda x=' ': list(map(int,input().rstrip().split(x)))
RS=lambda x=' ': input().rstrip().split(x)
dX= [-1, 1, 0, 0,-1, 1,-1, 1]
dY= [ 0, 0,-1, 1, 1,-1,-1, 1]
mod=int(1e9+7)
eps=1e-14
MAX=1010
##############################... |
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... | //Codeforces Round 385 (Div. 2)
import java.io.*;
import java.util.*;
public class TaskA {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
String s = sc.nextLine();
HashSet<String> h = new HashSet<String>(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;
template <class T1>
void deb(T1 e) {
cout << "-->" << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
cout << "-->" << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
cout << "-->" << e1 << " " << ... |
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()
b=list(a)
c=len(b)
d=0
e=""
f=""
g=0
while g<c:
while d<c:
e=e+str(b[d])
d=d+1
if f.find(e)>=0:
pass
else:
f=f+" "+e
d=0
e=""
b=[b.pop()]+b
g=g+1
f=f.split()
print(len(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... | def PerformShift(letters):
temp = letters.pop()
letters.insert(0,temp)
def GetWord(letters):
word = ''
for i in letters:
word += i
return word
def CyclicShift():
s = raw_input()
letters = []
for i in s:
letters.append(i)
#print letters
words = []
while 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... | s=input()
b=sorted(s)
l=[]
counter=1
i=1
if b[0]==b[len(b)-1]:
print(1)
exit()
else:
a=s[1:len(s)]+s[0]
while a!=s:
a=a[1:len(a)]+a[0]
counter+=1
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... | s=raw_input()
n=len(s)
l=set()
l.add(s)
for i in range(n):
s=s[-1]+s[:-1]
l.add(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... | s=input()
l=[]
l.append(s)
j=0
while(j<len(s)-1):
y=""
y=s[len(s)-1]
i=1
while(i<len(s)):
y=y+s[i-1]
i=i+1
if y not in l:
l.append(y)
s=y
j=j+1
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;
int main() {
string s, p, z;
long long n, i, j, ans = 0;
cin >> s;
set<string> st;
n = s.size();
p = s;
while (1) {
z += p[n - 1];
for (i = 0; i < n - 1; i++) z += p[i];
st.insert(z);
p = z;
z.clear();
if (p == s) break;
}
ans = 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;
int n = s.size();
int answer = n;
set<string> lst;
for (int i = 0; i < n; i++) {
string c = "";
for (int j = 0; j < n; j++) {
c += s[(i + j) % n];
}
lst.insert(c);
}
cout << lst.size() << endl;
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> st;
st.insert(s);
int sz = s.size();
for (int i = 0; i < 100; i++) {
string q = "";
int cur = i;
cur %= sz;
for (int j = 0; j < sz; j++) {
q += s[cur];
cur++;
cur %= sz;
}
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;
int n = s.size();
char store[n + 1][n + 1];
for (int i = 0; i < n; i++) {
char x[n + 1];
x[n] = '\0';
x[0] = s[n - 1];
for (int j = 0; j < n - 1; j++) {
x[j + 1] = s[j];
}
for (int j = 0; j <= 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... | word = input()
n = len(word)
x = 1
l = []
l.append(word)
for i in range(n):
word = word[n-1] + word[:-1]
if word not in l:
l.append(word)
x = x + 1
print(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 a[26];
int main() {
string s;
char x;
set<string> S;
cin >> s;
for (int i = 0; i < s.size(); i++) {
x = s[s.size() - 1], s.erase(s.begin() + s.size() - 1);
s.insert(s.begin(), x);
S.insert(s);
}
cout << S.size() << 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... | #include <bits/stdc++.h>
using namespace std;
string doTheShift(string s) {
s.insert(0, string(1, s[s.length() - 1]));
s.pop_back();
return s;
}
int main() {
string s;
cin >> s;
string g = doTheShift(s);
int count = 1;
while (g != s) {
++count;
g = doTheShift(g);
}
cout << count;
return EX... |
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=list()
a.append(s)
b=list(s)
x=1
for i in range(100):
b.insert(0,b.pop())
s="".join(b)
if s not in a:
a.append(s)
x+=1
print(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... | n=input()
v=''
lst=[]
lst1=[]
for i in n:
lst.append(i)
while(True):
lst.append(lst[0])
lst.remove(lst[0])
for j in lst:
v+=j
if(v not in lst1):
lst1.append(v)
v=''
else:
break
print(len(lst1))
|
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() {
long long int res = 0, i, j, pos, r = 0, ans = 0, len, cnt;
char s[500][500];
cin >> s[0];
len = strlen(s[0]);
for (i = 0; i < len; i++) {
s[i + 1][0] = s[i][len - 1];
for (j = 0; j < len - 1; j++) {
s[i + 1][j + 1] = s[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... | y=raw_input()
z=[]
while y not in z:
z.append(y)
a=y[0]
b=y[len(y)-1]
y=b+y[:len(y)-1]
print len(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... | a = set()
string = input()
for i in range(len(string)):
string = string[-1] + string[:-1]
a.add(string)
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;
bool isPrime(long long n) {
if (n <= 1) return false;
for (long long i = 2; i < n; i++)
if (n % i == 0) return false;
return true;
}
long long SieveOfEratosthenes(long long n, long long a) {
bool prime[n + 1];
memset(prime, true, sizeof(prime));
for (long lo... |
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 Main {
private void solve (Scanner in, PrintWriter out) {
String line = in.next();
Set<String> words = new HashSet<>();
for (int i = 0; i < line.length(); i ++) {
String temp = line.substring(i, line.length()) + line.substrin... |
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()
l=[x]
x=list(x)
for i in range(len(x)-1):
x.insert(0,x.pop())
if not ''.join(x) in l:
l.append(''.join(x))
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;
int main() {
int n, count = 0;
string s1, s2, s3;
cin >> s1;
n = s1.length();
s3 = s1;
s2 = s1;
if (count == 0) {
while (count < 1) {
s2[0] = s3[n - 1];
for (int i = 0; i < n - 1; i++) s2[i + 1] = s3[i];
s3 = s2;
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... | S = raw_input()
l = len(S)
A = set()
A.add(S)
for i in xrange(1, len(S)):
A.add(S[i:l] + S[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... | def different_words(s):
return (lambda t: len(set(s[i:] + s[:i] for i in range(len(s)))))(s)
print(different_words(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... | person = raw_input()
dic = {}
li = []
count = 0
for i in range(0,len(person)):
li.append(person[i])
dic[person] = 1
for i in range(0,len(person)):
temp = li[-1]
del li[-1]
li.insert(0,temp)
dic[''.join(li)]=0
for f in dic:
count = 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... | x=input()
st=set()
for i in range(len(x)):
se=x[len(x)-1]+x[0:len(x)-1]
st.add(se)
x=se
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... | s = input()
ln = len(s)
S = s * 2
print(len(set(S[i:i+ ln] for i in range(ln)))) |
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 Hongcow
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String[] arr = new String[s.length()];
arr[0] = s;
int count = 1;
for(int i=1; i<s.length(); i++)
{
String last = s.charAt(s.length() - 1) + "";
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.*;
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 java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main
{
public static void main(String[] arg... |
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()
strings = set()
def shift(s):
return str(s[-1]) + s[:-1]
for i in range(len(s)):
s = shift(s)
strings.add(s)
print len(strings) |
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 Prob1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String a=scanner.next();
String b=a;
int k=0;
while(true){
a=""+a.charAt(a.length()-1) + a.substring(0,a.length()-1);
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... | #include <bits/stdc++.h>
int main() {
using namespace std;
string str;
cin >> str;
int len = str.length();
for (int i = 1; i <= len; i++) {
if (len % i) continue;
for (int j = 0; j < len; j++)
if (str[j] != str[j % i]) goto lbl;
cout << i;
return 0;
lbl:;
}
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.HashSet;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
HashSet<String> set = new HashSet<>();
for (int i = 0; i < str.length(); i++) {
set.add(str.su... |
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 = set()
for i in xrange(len(s)):
s = s[-1] + s[:-1]
d.add(s)
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 s1 = "", s2 = " ";
int n = 0, a = 0, b = 1;
cin >> s1;
s2 += s1 + ' ';
n = s1.size();
for (int i = 0; i < n; i++) {
s1 = s1[n - 1] + s1;
s1.erase(n, 1);
a = s2.find(' ' + s1 + ' ');
if (a == -1) {
s2 += s1 + ' ';
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()
r=set()
for _ in s[:]:
s=s[1:]+s[0:1]
r=r|{s}
print(len(r)) |
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 Bomb {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String x = scanner.nextLine();
String s = "";
String k = "";
String z = x;
int i= 0;
while (true){
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... | import java.util.Scanner;
import java.util.ArrayList;
public class Solution {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String str = scan.next();
int count = 1;
ArrayList<String> arr = new ArrayList<>();
arr.add(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... | s=input()
t=[s]
k=len(s)-1
for i in range(k):
s=s[k]+s[0:k]
t.append(s)
t=list(set(t))
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... | a = raw_input()
count = 0
l = [a]
i = 0
b = a
while(i<len(a)):
b = b[1:]+b[0]
if b not in l:
count+=1
l.append(b)
i = i + 1
print count + 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()
sl = len(s)
l = set()
for i in range(sl):
new_s = s[sl-1] + s[:-1]
l.add(new_s)
s = new_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... | a=input()
n=len(a)
lis=[]
lis.append(a)
for i in range(1,n):
newstr=a[i:n]+a[:i]
lis.append(newstr)
set_lis=set(lis)
print(len(set_lis))
|
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=[s[i:]+s[:i] for i in range(len(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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, copy;
cin >> s;
int len = s.length(), c = 1;
copy = s;
s = s.substr(1, len - 1) + s.substr(0, 1);
while (s != copy) {
s = s.substr(1, len - 1) + s.substr(0, 1);
c += 1;
}
cout << c << 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... | #include <bits/stdc++.h>
using namespace std;
int main() {
map<string, int> ma;
string a, s;
cin >> s;
int i, j, l = s.length();
for (i = 0; i < l + 2; i++) {
a = "";
for (j = 0; j < l - 1; j++) a = a + s.at(j);
char c = s.at(l - 1);
a = c + a;
ma[a] = 1;
s = a;
}
cout << ma.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.util.*;
public class p745a{
static boolean comp(int i,String s){
int k,j,p;
for(k=0;k<i;k++)
{
p=0;
for(j=k-1;j!=k;j=(j+1)%s.length())
{
if(p==0) j=k+1;
if(s.charAt(p++)!=s.charAt(j)) break;
if(j==k-1) return false;
if(j==s.length()-1 && k==0) return false;
}
}
return true;
}
publ... |
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()
b=''
c=0
d=a
while(b!=d):
c+=1
b=a[1:]+a[:1]
a=b
print(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... |
R = lambda:map(int,input().split())
val = input()
ans = set()
for i in range(len(val)):
s = val[i:] + val[:i]
if s not in ans:
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... | #include <bits/stdc++.h>
using namespace std;
string s;
int i, b, ans, j;
map<string, int> my;
int main() {
cin >> s;
b = s.size();
for (i = b - 1; i >= 0; i--) {
string d = "";
d += s[b - 1];
for (j = 0; j < b - 1; j++) {
d += s[j];
}
s = d;
if (my[s] == 0) {
my[s]++;
an... |
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 whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
static ArrayList<Integer> g[], revG[];
static int vis[], id;
static Stack<Integer> stack;
static final int MA... |
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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
//solution start :-)
Scanner sc = new Scanner(System.in);
String s = sc.next();
int n = s.length();
int k = n-1;
Set<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 = input()
res = set()
for i in range(len(s)):
res.add(s[i:] + s[:i])
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, f;
cin >> s;
f = s + s;
cout << f.find(s, 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... | #include <bits/stdc++.h>
using namespace std;
int main() {
char a[100], flag = 1, flag1 = 0;
cin >> a;
for (int i = 0; i < strlen(a); i++) {
if (a[0] != a[i]) {
flag = 0;
break;
}
}
if (flag) {
flag1 = 2;
cout << "1";
} else {
for (int i = 0; i < strlen(a) / 2; i++) {
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 java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
String str=sc.next();
HashSet <String> hs = new... |
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(void) {
string str;
cin >> str;
string cstr = str;
bool f = false;
int counter = 1;
while (1) {
str.insert(str.begin(), str[str.length() - 1]);
str.erase(str.end() - 1);
if (str == cstr) break;
counter++;
}
cout << counter << 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... | import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
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.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
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()
from collections import deque
s=deque(s)
temp=s.copy()
temp.rotate()
count=1
while s!=temp:
temp.rotate()
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... | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long MOD = 998244353;
double eps = 1e-12;
void solve(string &s) {
reverse(s.begin(), s.begin() + 1);
reverse(s.begin() + 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;
string s[100];
int sum, q;
int main() {
cin >> s[0];
int n = s[0].size();
for (int i = 0; i < n; i++) {
char x = s[i][n - 1];
s[i].erase(n - 1, n - 1);
s[i + 1] = x + s[i];
}
for (int i = 0; i < n; i++) {
int k = 0;
for (int j = i + 1; j < 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... | s = input()
ss = set()
for i in range(len(s)):
a = s[-1]+s[0:-1]
ss.add(a)
s = a
print(len(ss)) |
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 = []
strings.append(s)
i = 0
while i < len(s):
s = s[1:] + s[0]
if s not in strings:
strings.append(s)
i = i + 1
print(len(strings))
|
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=[]
l.append(s)
ctr=1
n=len(s)
a=s[n-1]+s[:n-1]
for i in range(n):
a=a[n-1]+a[:n-1]
if a not in l:
ctr=ctr+1
l.append(a)
print(ctr) |
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) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine();
int len = input.length();
Set<String> set = new HashSet<String>();
set.add(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... | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e6 + 7;
int main() {
int t, n;
string s;
cin >> s;
map<string, int> q;
int len = s.size();
int ans = 0;
for (int i = 0; i < len; i++) {
string str;
for (int j = i; j < len; j++) str += s[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... | #include <bits/stdc++.h>
int main() {
int n, i, j, c = 0, d = 0, k, l;
char s[51];
scanf("%s", s);
n = strlen(s);
char g;
char t[51];
strcpy(t, s);
for (i = 0; i < n; i++) {
char ch = s[n - 1];
for (j = n - 1; j >= 1; j--) s[j] = s[j - 1];
s[0] = ch;
c++;
if (strcmp(t, s) == 0) 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... | import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.SynchronousQueue;
public class Main {
MyScanner sc = new MyScanner();
Scanner sc2 = new Scanner(System.in);
long start = System.currentTimeMillis();
long fin ... |
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.util.HashSet;
import java.util.InputMismatchException;
public class HongcowLearnsTheCyclicShift {
public static void main(String[] args) {
FasterScanner sc = new FasterScanner();
String S = sc.nextLine();
int N = S.length();
HashSet<String> set = new HashSet<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... | linea = input()
lin = list(linea)
c=0
rep = []
for l in lin:
faux = True
ult = lin[len(lin)-1]
ini = lin[0]
lin.insert(0,ult)
lin.pop(len(lin)-1)
s = ''.join(lin)
for el in rep:
if s == el:
faux = False
if faux:
if s != linea:
c = c+1
rep.... |
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()
l = len(s)
s = s+s;
L =[];
for i in range(l):
z = s[i:i+l];
#print z
L.append(z)
print len(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... | import java.io.*;
import java.util.*;
import javax.naming.NameAlreadyBoundException;
public class Geometry {
static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
static int maxArray(int[] a) {
int Max = Integer.MIN_VALUE;
for (int i = 0; i < a.length; i++) {
if (Max < a[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 java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner in = new Scanner(System.in);
String s = in.nextLine();
//Sy... |
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()
s1 = s
def transform(s):
return s[-1] + s[:len(s) - 1]
s = transform(s)
count = 1
while s != s1:
s = transform(s)
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... | s = input()
e = s
ss = set()
for i in range(len(s)):
e = e[-1] + e[:-1]
ss.add(e)
print(len(ss))
|
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 P = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
long long r = 1 % P;
for (a %= P; n; a = a * a % P, n >>= 1)
if (n & 1) r = r * a % P;
return r;
}
void exgcd(long long a, 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... |
if __name__ == "__main__" :
hash = {}
hash1 = {}
string = list( raw_input() )
for i in string :
if i not in hash :
hash[ i ] = 0
List = list( string )
counter = 1
if len( hash ) == len( string ) :
print len( string )
else :
while True:
te... |
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()
n=len(s)
l=[s]
for i in range(n):
s=s[-1]+s[0:-1]
l.append(s)
print(len(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... | #include <bits/stdc++.h>
using namespace std;
char s[55];
set<string> v;
int main() {
scanf(" %s", s);
int len = strlen(s), aux;
int st = 0;
aux = len;
while (aux--) {
int cont = 0;
char nx[55];
for (int i = st; cont < len; i++, cont++) {
if (i == len) i = 0;
nx[cont] = s[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;
string rep(string s) {
int n = s.size();
string s1;
for (int i = 1; i < n; i++) {
s1.push_back(s[i]);
}
s1.push_back(s[0]);
return s1;
}
int main() {
string s;
cin >> s;
int n = s.size();
set<string> se;
se.insert(s);
for (int i = 0; i < n; 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()
ans = []
for i in range(len(s)):
ans.append(s[-i:] + s[:-i])
print(len(set(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, c, stos[1000];
int n, wynik, wsk;
int main() {
cin >> s;
c = s;
n = s.size();
stos[0] = c;
wsk++;
for (int i = 1; i < n; i++) {
c = c[n - 1] + c;
c.erase(n, 1);
stos[wsk] = c;
wsk++;
}
sort(stos, stos + wsk);
for (int i = 0; i < 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... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**... |
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
def go():
s = raw_input()
st= set()
for i in range(len(s)):
st.add(s)
s=s[-1]+s[:-1]
return len(st)
print go()
|
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 shift(a):
b = a[len(a) - 1] + a[:len(a)-1]
return b
lis = []
inp = input().lower()
ctr = 0
while ctr < len(inp):
if inp not in lis:
lis.append(inp)
inp = shift(inp)
ctr+=1
print(len(lis)) |
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
#n,a,b = map(int,sys.stdin.readline().split())
str=sys.stdin.readline()
str=str.strip()
S=[]
for i in range(len(str)):
s=str[i:]+str[:i]
if s not in S:
S.append(s)
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... | class CyclicShifter:
def calculate(self, source_string):
length = len(source_string)
uniqs = set()
shifted = source_string[-1] + source_string[:-1]
for i in range(0, length):
uniqs.add(shifted)
shifted = shifted[-1] + shifted[:-1]
return len(uniqs)
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, w, count = list(input()), [], 1
w.extend(s)
while True:
s.insert(0, s.pop(-1))
if w != s:
count += 1
else:
print(count)
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 abs(int a) { return a < 0 ? -1 * a : a; }
int res;
map<string, int> a;
string s;
int main() {
cin >> s;
int n = s.size();
for (int i = 0; i < n; i++) {
char ch = s[n - 1];
s.erase(n - 1, 1);
s = ch + s;
if (!a[s]) res++;
a[s] = 1;
}
cout <<... |
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()
n = len(s)
res = set()
for i in range(n):
res.add(s[i:] + s[:i])
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> ss;
for (int i = 0; i < s.length(); i++) {
ss.insert(s.substr(i, s.length()) + s.substr(0, i));
}
cout << ss.size() << endl;
ss.clear();
}
|
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()
n = [a]
for i in range(len(a)):
a = a[-1]+a[0:len(a)-1]
if a not in n:
n.append(a)
else:
break
print(len(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... | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
string s;
cin >> s;
vector<string> a;
a.push_back(s);
for (int i = 0; i < s.size(); i++) {
char ss = s[s.size() - 1];
s.erase(s.end() - 1);
s.insert(s.begin(), ss);
bool find = false;
for (int j = 0; j < a.siz... |
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()
for i in range(1, len(s)+1):
if s == s[i:]+s[:i]:
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;
string s;
set<string> M;
int main() {
while (cin >> s) {
M.clear();
M.insert(s);
int len = s.length();
for (int i = 1; i < len; i++) {
string str = "";
for (int j = 0; j < len; j++) {
str += s[(i + j) % len];
}
M.insert(str)... |
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.HashSet;
import java.util.StringTokenizer;
/**
* Created by WiNDWAY on 12/17/16.
*/
public class Codeforces_round_385_div_2_HongcowLearnsTheCyclicShift {
public static void main(String[] args) {
FScanner input = new FScanner();
out = new PrintWriter(new Buffer... |
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... | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* author ssaxena36
*
*/
import java.io.*;
import java.util.*;
public class MIXTURES
{
void solve()
{
HashSe... |
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()
c=1
z=a[-1]+a[:len(a)-1]
while(z!=a):
z=z[-1]+z[:len(z)-1]
c+=1
print(c) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.