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 java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
Integer n = str.length();
Integer flag = 0;
Integer min = n;
String dup = "";
for(int i=1;i<n;i++){
if(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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
vector<string> a;
int k = s.size();
for (size_t i = 0; i < s.size(); i++) {
bool f = false;
for (int j = 0; j < a.size(); j++)
if (a[j] == s) {
k--;
break;
}
a.push_back(s);
s = s.substr(... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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()
newS = s
for i in range(len(s)):
a.add(newS)
newS = newS[-1] + newS[0:-1]
print(len(a))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=raw_input()
def applyshift(s):
s2=s[-1]+s[:-1]
return s2
l=[]
for k in s:
s=applyshift(s)
if s not in l:
l.append(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;
string s;
int main() {
cin >> s;
int i, b = 0;
string c = "0";
while (c != s) {
if (c == "0") c = s;
i = 0;
while (i < s.size() - 1) {
swap(c[i], c[i + 1]);
i++;
}
b++;
}
cout << b;
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 Main {
public static void main(String args []){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
String input = scan.next();
int len = input.length() ;
char [] charInput = input.toCharArray();
String [] words = new String[ len];... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
set<string> st;
int main() {
string s;
cin >> s;
st.insert(s);
for (int i = 0; i < s.length(); ++i) {
char c = s[s.length() - 1];
s.erase(s.length() - 1, 1);
s.insert(0, 1, c);
st.insert(s);
}
cout << st.size() << "\n";
return 0;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
c = set()
for i in range(len(s)):
s = s[1:] + s[0]
c.add(s)
print(len(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... | #include <bits/stdc++.h>
using namespace std;
int32_t main() {
string s;
cin >> s;
set<string> a;
for (int i = 0; i < s.size(); i++) {
long long e = s.size() - i;
string s1 = s.substr(e, s.size() - e) + s.substr(0, e);
a.insert(s1);
}
cout << a.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... |
def rotate(a):
l=len(a)
k=a[l-1]
b=''
for i in range(1,l):
c=a[i-1]
b=b+c
b=k+b
return b
a=raw_input()
arr=[]
kik=a
for i in range(0,len(a)):
dip=rotate(kik)
if dip not in arr:
arr=arr + [dip]
kik=dip
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... | s=input()
a=s[::-1]
#print(a)
for i in range(len(s)):
if a[i]==s[0]:
d=a[:i+1][::-1]+a[i+1:][::-1]
#print(a[:i+1][::-1]+a[i+1:][::-1])
if d==s:
#print(d)
print(i+1)
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... | st = input()
arr = []
for i in range(len(st)):
arr.append(st[i:] + st[:i])
arr = sorted(arr)
cnt = 1
for i in range(1,len(st)):
if(arr[i] != arr[i-1]):
cnt = cnt + 1
print(cnt) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
void doit() {
string s;
cin >> s;
int len = s.length(), ct = 1;
string dup = s;
s = s.substr(1, len) + s.substr(0, 1);
while (dup != s) {
s = s.substr(1, len) + s.substr(0, 1);
ct++;
}
cout << ct << endl;
}
int main() {
ios_base::sync_with_stdio(fa... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 = {s}
l = len(s)
for i in range(l-1):
s = s[l-1]+s[:l-1]
ss.add(s)
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... | import java.util.*;
import java.io.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
public class Test {
public static void main(String aa[])throws Exception
{
Scan s=new Scan();
char ch[]=s.scanString().toCharArray();
HashSet<String> h1=new HashSet<>();
int n=ch.... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws java.lan... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 Code{
public static void main(String args[]){
Scanner r=new Scanner(System.in);
String s1 = r.next();
HashSet<String> t = new HashSet<String>();
for(int i=0;i<s1.length();i++){
t.add(s1);
s1 = s1.charAt(s1.length()-1)+s1.substring(0,s1.le... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 x;
string a = s + s;
a.erase(0, 1);
cout << a.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... | //package codeforces;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String line = re... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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, i;
n = s.length();
for (i = 0; i <= n; i++) {
m[s]++;
char c = s[n - 1];
s.pop_back();
s = c + s;
}
cout << m.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... |
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Hongcow {
public static void main(String[] args){
String input;
Scanner sc = new Scanner(System.in);
Set<String> list = new HashSet<String>();
list.add(input = sc.nextLine());
for(int i=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() {
string s, p;
cin >> s;
p = s;
int a = 0;
do {
s += s[0];
s.erase(s.begin());
a++;
} while (s != p);
cout << a;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.HashSet;
import java.util.Scanner;
public class HongcowLearnstheCyclicShift {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s=scan.nextLine();
int n=s.length();
HashSet<String> h=new HashSet<>();
h.add(s);
int cnt=0;
for(int i=0;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... | s = raw_input()
d = []
for i in range(len(s)):
s = s[-1] + s
s = s[:-1]
if s in d:
continue
else:
d.append(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... | n=input()
l=[]
for i in range(len(n)):
l.append(n[i])
for i in range(len(n)):
a=l.pop()
l.insert(0,a)
if ("".join( j for j in l))==n:
print(i+1)
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()
a = set()
for i in range(len(s)):
a.add(s)
s = s[-1] + s[:-1]
print(len(a)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
i=0
t=[s]
j=1
p=len(s)
for i in range(p):
s=s[p-1]+s[0:(p-1):1]
if s not in t:
t.append(s)
j+=1
print(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... | def shift(s):
new_s = ""
new_s += s[-1]
new_s += s[:-1]
return new_s
s = input()
n = len(s)
res = set()
res.add(s)
for i in range(n):
s = shift(s)
res.add(s)
print(len(res)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
public class CyclicShift_745A {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
HashSet h = new HashSet();
for (int i = 0; i < s.length(); i++) {
h.add(s);
s = s.charAt(s.length() - 1) + s.substring(0, s.length() - 1);
}
System.... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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)
q = set()
for i in range(n):
t = ''
for j in range(n):
t += s[(i + j) % n]
q.add(t)
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... | #CF YL1
s=input()
c={s}
def cyc(s2):return s2[-1]+s2[:-1]
for i in range(len(s)):
s=cyc(s)
c.add(s)
print(len(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.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Solution
{
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... | import sys
def shift(s):
new = ['1'] * len(s)
new[0] = s[-1]
for i in range(len(s) - 1):
new[i + 1] = s[i]
return ''.join(new)
fin = sys.stdin
fout = sys.stdout
s = fin.readline().strip()
newS = set()
newS.add(s)
curS = s
for i in range(len(s) + 3):
curS = shift(curS)
newS.add(curS)
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 A {
public static void main(String[] args) {
Scanner in= new Scanner(System.in);
String a= in.nextLine();
HashSet<String> s= new HashSet<String>();
for (int i = 0; i < a.length(); i++) {
String nex= a.charAt(a.length()-1)+a.substring(0, a.len... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
public class A745 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str = scan.next();
int n = str.length();
Set<String> set = new HashSet();
for (int i = 0; i < n; i++) {
int cur = i;
String next = "";
for (int j = 0; j < n; ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s= str(input())
l= len(s)
test=[]
final=[]
new=''
for i in range(l):
new= s[1:]+s[0]
s=new
test.append(new)
for i in test:
if i not in final:
final.append(i)
print(len(final)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 alp[26];
int main() {
string s;
cin >> s;
int cnt = 1;
string t = s;
t.push_back(t[0]);
t.erase(t.begin());
while (t != s) {
t.push_back(t[0]);
t.erase(t.begin());
cnt++;
}
cout << cnt << 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... | a = input()
a = list(a)
def move(a):
k = a[0]
for i in range(len(a) - 1):
a[i] = a[i + 1]
a[-1] = k
return a
res = 1
s = set()
s.add(''.join(a))
for i in range(len(a) + 1):
a = move(a)
if ''.join(a) not in s:
res += 1
s.add(''.join(a))
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.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;
public class Main
{
public static boolean[] sieve(long n)
{
boolean[] prime = new boolean[(int)n+1];
Arrays.fill(pr... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | /**
* DA-IICT
* Author : Savaliya Sagar.
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class A744 {
public static int mod = 1000000007;
static FasterScanner in = new FasterScanner();
static PrintWriter o = new PrintWriter(System.out);
public static void main(String[] args) {
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 ans;
string s;
map<string, bool> used;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (used.find(s) == used.end()) {
ans++;
used[s] = true;
}
s += s[0];
s.erase(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.*;
import java.util.*;
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
public class R385A {
static TreeSet<String> set;
public static void main(String[] args) throws Exception {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new Pri... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 A745 {
static BufferedReader br;
static StringTokenizer st;
static PrintWriter out;
public static void main(String[] args) {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
solve();
out.close();
}
static void... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 len = s.length();
map<string, int> mp;
for (int i = 0; i <= len; i++) {
s.insert(s.begin(), s[len - 1]);
s.pop_back();
mp[s]++;
}
cout << mp.size() << endl;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
string s;
set<string> st;
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> s;
st.insert(s);
for (long long i = 0; i < ((long long)s.size()); ++i) {
s = s[((long long)s.size()) - 1] + s.substr(0, ((long long)s.size()) - 1);
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... | import java.util.*;
public class F2 {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
StringBuffer sb = new StringBuffer(sc.next());
List<String> list = new LinkedList();
for(int i=0 ;i<sb.length() ; i++){
String s = sb.toString();
if(!list.contains(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.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Arrays;
import java.... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 c[200000];
map<string, int> mark;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> c;
int n = strlen(c), ans = 0;
for (int i = 0; i < n; i++) {
string s;
for (int j = i; j < (i + n); j++) {
s.push_back(c[j % 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... | word=list(input())
x=[]
str1 = ''.join(word)
x.append(str(str1))
count=1
for i in range(len(word)-1) :
word.insert(0,word[-1])
del word[-1]
str1 = ''.join(word)
if str1 not in x :
count+=1
x.append(str1)
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,vars=input(),set()
vars.add(s)
for i in range(1,len(s)):vars.add(s[i:]+s[:i])
print(len(vars)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #testing here
w = []
s = input()
w.append(s)
wordlength = len(s)
s = s+s[0:wordlength-1]
for i in range(1,wordlength):
word=s[i:i+wordlength]
if word not in w:
w.append(word)
print(len(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... | s=input().strip()
sss=set()
for x in range(len(s)):
sss.add(s[x:]+s[:x])
print(len(sss)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
x = False
ss = ""
if s.count(s[0]) == len(s):
print(1)
x = True
else:
for i in s:
ss += i
if s.count(ss) * len(ss) == len(s):
print(len(ss))
x = True
break
if x == False:
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.io.*;
import java.util.*;
public class Main {
private static void solver(InputReader sc, PrintWriter out) throws Exception {
String s = sc.next();
Set<String> hs = new HashSet<>();
hs.add(s);
StringBuilder sb = new StringBuilder(s);
int n = s.length();
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... | string = input()
s = set()
for _ in range(len(string)):
string = string[-1] + string[:-1]
s.add(string)
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>
int main() {
char a[50][51];
int p = 0, i = 0, k = 0, j, f;
scanf("%s", &a[0][0]);
k = strlen(a[0]);
for (i = 0; i < k - 1; i++) {
for (j = 0; j < k - 1; j++) {
a[i + 1][j + 1] = a[i][j];
}
a[i + 1][0] = a[i][j];
a[i + 1][j + 1] = '\0';
}
for (i = 0; i < k; 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... | #http://codeforces.com/contest/745/problem/A
l=input()
s=set()
for i in range(len(l)):
l=l[1:]+l[0]
s.add(l)
print(len(s))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | S = input()
s = set([])
N = len(S)
for i in range(N):
new_S = S[i:] + S[:i]
s.add(new_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... | #include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238;
long long powmod(long long a, long long b) {
long long res = 1;
a %= 1000000007;
for (; b; b >>= 1) {
if (b & 1) res = res * a % 1000000007;
a = a * a % 1000000007;
}
return res;
}
char str[200005];
int lps[200005];
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 shift(string asd) {
string asdd;
char c = asd[asd.length() - 1];
asd.pop_back();
asdd.push_back(c);
asdd += asd;
return asdd;
}
int main() {
int c = 1;
string asd, asdd;
cin >> asd;
asdd = shift(asd);
while (asd != asdd) {
c++;
asdd = sh... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 long long N = 1e5 + 5;
vector<int> v;
int n, cnt, lnt, mx;
string m;
set<string> a;
int main() {
cin >> m;
for (int i = 1; i <= m.size(); i++) {
for (int j = 0; j < m.size() - 1; j++) {
swap(m[j], m[j + 1]);
}
a.insert(m);
}
cout << a.size();... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int N;
string S;
map<string, int> mapa;
int main() {
cin >> S;
N = S.size();
S = S + S;
for (int i = 0; i < N; i++) {
string A = "";
for (int j = i; j < N + i; j++) A = A + S[j];
mapa[A]++;
}
cout << mapa.size();
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.*;
import java.util.*;
public class test
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
String s = in.next();
char[] arrS = s.toCharArray();
boolean flag1=true;
for(int i=0;i<arrS.length-1;i++)
{
if(arrS[i+1]!=arrS[i])
{
flag1=false;
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... | string = input()
Set = set()
for i in range(0,string.__len__()):
Set.add(string)
string = string[-1]+string[:-1]
print(Set.__len__())
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class contest {
public static void main(String[] args) throws IOException {
Sca... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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.math.BigInteger;
import java.text.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
LinkedHashSet ls=new LinkedHashSet();
String ax=s.nextLine();
for(int i=0;i<ax.length();i++){
ax=ax.charAt(ax.length()-1)+ax.substr... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string str;
int sz;
while (cin >> str) {
std::set<std::string> sss;
sss.insert(str);
sz = str.size();
for (int i = 0; i < sz; i++) {
string str2 = "";
char ch = str[sz - 1];
for (int j = 0; j < sz - 1; j++) {
str2... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 a1, a2;
vector<string> v;
int main() {
cin >> a1;
int len = a1.length();
for (int i = 0; i < len; i++) {
a2 = string();
for (int j = 0; j < len; j++) {
a2 = a2 + a1[(j + i) % len];
}
v.push_back(a2);
}
sort(v.begin(), v.end());
v.era... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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(s):
return s[1:]+s[0]
Str=raw_input().strip()
Set_str=set()
for i in range(len(Str)):
Set_str.add(Str)
Str=shift(Str)
print len(Set_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... | c=1;
d = input("")
r = d[-1] + d[0:-1]
while r != d:
r = r[-1] + r[0:-1]
c += 1
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... |
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class A{
static long mod=1000000007;
public static void main(String[] args) throws Exception{
InputReader in = new InputReader(System.in);
PrintWrite... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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.*;
/*
* 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 tazzo
*/
public class Hongcow {
public static void main(String[] args){... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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;
/**
* Created by sanjayarvind on 19/01/2017 AD.
*/
public class CR385 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int n = s.length(), i = 0;
HashSet<String> words = new Ha... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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()
ans={n}
for i in range(52):
n=n[-1]+n[:-1]
ans.add(n)
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... | from operator import itemgetter
#int(input())
#map(int,input().split())
#[list(map(int,input().split())) for i in range(q)]
#print("YES" * ans + "NO" * (1-ans))
s = input()
strs = set()
for i in range(len(s)):
strs.add(s[-i:] + s[:-i])
print(len(strs))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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(s):
return s[1:] + s[0]
se = set()
s = raw_input()
for i in xrange(len(s)):
s = shift(s)
se.add(s)
print len(se)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
string cycle(string s) {
char c = s[0];
for (int i = 1; i < s.size(); i++) s[i - 1] = s[i];
s[s.size() - 1] = c;
return s;
}
int main() {
string s;
int cnt = 0;
map<string, int> mkd;
cin >> s;
for (int i = 0; i < 60; i++) {
if (mkd[s] == 0) cnt++;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
k=s[-1]+s[:-1]
ans=1
while s!=k:
k=k[-1]+k[:-1]
ans+=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... | from sys import stdin, stdout;
s = set()
f = stdin.readline().strip()
for i in range(len(f)):
s.add(f[i:] + f[:i])
stdout.write(str(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()
ans=set()
ans.add(s)
_len=len(s)
i=_len-1
while i>0:
s=s[-1]+s[:-1]
ans.add(s)
i-=1
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;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
map<string, int> uni;
string s;
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... | S=input()
S1=[]
k=0
for i in range(len(S)) :
S=S[len(S)-1]+S[0]+S[1:len(S)-1]
S1.append(S)
S2=set(S1)
print(len(S2))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | # -*- coding:utf-8 -*-
import sys
def some_func():
"""
"""
n_str = raw_input()
cache = {}
for i in range(len(n_str)):
cache[''.join([n_str[i:],n_str[:i]])]=''
print len(cache)
if __name__ == '__main__':
some_func()
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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)
comb=[]
comb.append(s)
cur=[0]*n
for i in range(1,n):
x=comb[i-1]
for j in range(n):
cur[(j+1)%n]=x[j%n]
comb.append(''.join(cur))
ans={}
for i in comb:
ans[i]=1
print len(ans)
#print comb
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | # coding=utf-8
s=raw_input()
n=len(s)
temp=[]
ans=0
if len(set(s))==1:
print 1
else:
for i in range(1,n+1):
if s[(n-i):]+s[:(n-i)] not in temp:
temp.append(s[(n-i):]+s[:(n-i)])
ans+=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... | s=raw_input()
q=[s]
n=len(s)
for i in range(1,n):
s1=s[n-i:]+s[:n-i]
f=0
for j in q:
if j==s1:
f=1
break
if f==0:
q.append(s1)
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<char> ss;
map<string, bool> mp;
long long l = 0;
for (long long i = 0; i < s.size(); i++) {
if (!mp[s]) l++;
mp[s] = true;
rotate(s.begin(), s.end() - 1, s.end());
}
cout << l << endl;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
const char E = '\n';
int main() {
set<string> a;
string s;
cin >> s;
a.insert(s);
int n = s.length();
for (int i = 1; i <= n + 1; i++) {
char z = s[n - 1];
for (int j = n; j >= 1; j--) {
s[j] = s[j - 1];
}
s[0] = z;
a.insert(s);
}
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... | s = input()
print(len({s[i:]+s[:i] for i in range(len(s))}))
# Made By Mostafa_Khaled |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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(map(str,input()))
n=list(s)
l=len(s)
c=0
for i in range(l):
n.insert(0,n[-1])
n.pop()
c+=1
if n==s:
break
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... | import java.util.*;
import java.math.*;
import java.io.*;
public class Test1{
public static void main(String[] args){
FastReader sc = new FastReader();
String s = sc.next();
int length = s.length();
HashSet<String> hs = new HashSet<String>();
hs.add(s);
StringBuffer sb = new StringBuffer(s);
for(int i=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() {
int l, cnt = 0;
string str, check[50], temp;
cin >> str;
temp = str;
l = str.size();
for (int j = 0; j < l; j++) {
check[j] = str[l - 1];
str.erase(l - 1);
check[j] = check[j] + str;
str = check[j];
}
sort(check, check + l);
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... | x = str(raw_input())
d = []
for i in xrange(len(x)):
s = x[i:] + x[:i]
if s not in d:
d.append(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... | st = input()
tab = []
for i in range(len(st)):
tab.append(st)
st = st[-1:]+st[:-1]
print(len(set(tab))) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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={s:0}
for i in range(len(s)):
s=s[-1]+s[:-1]
d[s]=d.get(s,0)+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... | a = raw_input()
b=a
count=0
while True:
b=b[-1]+b[0:-1]
count+=1
if b==a:
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... | x = input().strip()
a = set()
l = len(x)-1
for i in range(len(x)):
x = x[l]+x[:l]
a.add(x)
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... | string = raw_input()
resset = set()
N = len(string)
for i in xrange(N):
resset.add(string)
string = string[1:] + string[0]
print len(resset)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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;
double X0;
double Y0;
const int MAXN = 5e3 + 3;
long long int n, k;
int main() {
string s, a, b;
int out = 1;
map<string, int> mapa;
cin >> s;
mapa[s] = 1;
for (int i = (int)0; i < (int)s.length(); i++) {
a = s[s.length() - 1];
b = s.substr(0, s.length()... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | a = input()
a = a.strip()
razlicni = set()
razlicni.add(a)
for _ in range(len(a)):
a = a[-1] + a[:-1]
razlicni.add(a)
print(len(razlicni))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.