prompt
string
response
string
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = raw_input() arr = [s] for i in xrange(len(s)): st = s[i:]+s[:i] if(st not in arr): arr.append(st) 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...
# Yergali B # 358 div 2 #n=int(input()) #a,b=map(int,input().split()) #a=list(map(int,input().split())) 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...
# import sys # sys.stdin=open("input1.in","r") # sys.stdout=open("output2.out","w") S=input() L=[] for i in range(len(S)): L.append(S[i:]+S[:i]) 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; int n; int main() { string str; while (cin >> str) { map<string, int> m; int n = str.size(); char t[500]; for (int i = 0; i < str.size(); i++) { int cnt = 0; for (int j = i; j < str.size(); j++) { t[cnt++] = str[j]; } for ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int n; char str[50][50 + 1]; int cnt; void copy(int id) { for (int i = 0; i < n; i++) str[id][i] = str[0][(i + id) % n]; } int main() { scanf("%s", str[0]); n = strlen(str[0]); for (int i = 1; i < n; i++) copy(i); for (int i = 0; i < n; i++) { int curcnt = 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 s; string n; string a, x; int res = 1; int main() { ios_base::sync_with_stdio(0); cin >> s; a = s.substr(s.length() - 1, s.length()); n = a + s.substr(0, s.length() - 1); while (n != s) { x = n.substr(n.length() - 1, n.length()); n = x + n.substr(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() l=len(s) z=[] z.append(s) k=1 for i in range(l-1): s=s[-1]+s[:l-1] if s not in z: z.append(s) k+=1 print(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...
a = set() s = input() ans = 0 n = len(s) for i in range(n): if not s in a: a.add(s) ans += 1 s = s[n-1] + s[:n-1] #print(s) 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...
def main(): strin = input() new = strin lis = [strin] for i in range(0,len(strin)-1): last = new[len(strin)-1] new = last+new; new = new[0:len(new)-1] lis.append(new) set_s = set(lis) print (len(set_s)) main()
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
n = input().strip() l = [] ans = 0 for i in range(len(n)): if n[i:]+n[:i] not in l: l.append(n[i:]+n[:i]) ans += 1 else: break print(ans)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { map<string, int> address; string server; cin >> server; address[server] = 1; int cnt = 1; auto itr = address.find(server); while (1) { string str1 = server.substr(0, server.length() - 1); string str2 = server.substr(server.length() - 1, 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 s; map<string, bool> used; unsigned long long n; unsigned long long cnt = 0; void read() { cin >> s; n = s.size(); } void solve() { for (unsigned long long i = 0; i < n; i++) { string crr = ""; for (unsigned long long j = n - i; j < n; j++) crr += s[j];...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); BufferedReader br=new BufferedReader(new InputStreamReader(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...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeSet; public class PlusMinus { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputSt...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 i, ans = 1, j; string s; string a[64]; cin >> s; a[0] = s; for (i = 1; i < s.size(); i++) { s = s[s.size() - 1] + s; s.erase(s.size() - 1); for (j = 0; j < ans; j++) if (s == a[j]) break; if (j == ans) { a[ans] = 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() r = [s] tempS = s for i in range(len(s) - 1): tempS = tempS[-1] + tempS[:-1] r.append(tempS) print(len(set(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...
// -*- coding: utf-8 -*- //import java.awt.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream; if (args.length > 0 && args[0].equals("devTesting")) { try { inputStream = new FileIn...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 cy(n): z=n[-1] x='' x+=z x+=n[0:-1] return x n=input() a=[] a.append(n) for i in range(len(n)): n=cy(n) if n not in a: a.append(n) print(len(a))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.*; import java.io.*; public class code385_1 { public static void main(String[] args) throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String input = reader.readLine(); int n = input.length(); String[] arr = new String[n]; for (int i = 0; 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.util.Scanner; public class HongcowLearnstheCyclicShift_745A { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str = input.next(); String s = str + str; System.out.println(s.indexOf(str, 1)); input.close(); } }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string f = s; int count = 0; do { char k = s[s.length() - 1]; for (int i = s.length() - 2; i >= 0; i--) { s[i + 1] = s[i]; } s[0] = k; count++; } while (f != s); cout << count; return 0; }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() a = {s[i:]+s[:i] for i in range(len(s))} print(len(a))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; bool solve() { string t; cin >> t; deque<char> a; for (int i = 0; i < (int)t.size(); i++) a.push_back(t[i]); map<deque<char>, int> mp; for (int i = 0; i < (int)a.size(); i++) { char t = a[(int)a.size() - 1]; a.pop_back(); ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.*; public class problem { 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...
import java.util.Scanner; public class CyclicShift { static int count=0; public static void main(String [] args){ Scanner sc = new Scanner(System.in); cycle(sc); sc.close(); } private static void cycle(Scanner sc){ String s1 = sc.nextLine(); String s2 = ""; for(int i=0; i<s1.length(); i++){ s2 = s1....
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { set<string> st; string s; cin >> s; if ((int)s.length() == 1) { cout << 1; return 0; } for (int i = 0; i < 55; i++) { st.insert(s); rotate(s.begin(), s.begin() + 1, s.end()); } cout << (int)st.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...
a=raw_input() ans=set([a]) for i in range(len(a)): a = a[1:]+a[0] ans.add(a) print len(ans)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.*; import java.util.*; public class A1008 { public static void main(String [] args) { InputStream inputReader = System.in; OutputStream outputReader = System.out; InputReader in = new InputReader(inputReader); PrintWriter out = new PrintWriter(outputReader); 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() arr=[] for i in range(len(s)): s=s[1:]+s[0] arr.append(s) print(len(set(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...
l = raw_input() s = set() s.add(l) n = len(l) for i in range(1, n): t = l[n-i:] + l[:n-i] # print t if t not in s: s.add(t) 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 = set() l = str(input()) for j in range(len(l)+10): l = l[len(l)-1] + l[0:len(l)-1] 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...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeSet; public class R385A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(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...
#include <bits/stdc++.h> using namespace std; map<string, int> a; int main() { string s; cin >> s; string ss = ""; for (int i = 0; i < s.size(); i++) { a[s]++; ss += s[s.size() - 1]; for (int j = 0; j < s.size() - 1; j++) { ss += s[j]; } s = ss; ss = ""; } cout << a.size() << e...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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. */ ///package CodeForce; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; 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...
/* Logic is the strongest weapon. */ import java.io.*; import java.util.*; public class Coding { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next(); int ans = 0; List<String> arr = new ArrayList<>(s.length()); int len = s.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.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.StringTokenizer; public class shift { static final boolean DEBUG = false; static void solve() { HashSet<String> set = new HashSet<>(); String s = next(); while(!set.contains...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
words = [] word = raw_input() words.append(word) for i in xrange (len(word)): word = word[-1] + word[0:len(word)-1] if word not in words: words.append(word) print len(words)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
a=list(input()) b=[] n=len(a) for k in range(n): t=a[0] a.remove(a[0]) a.append(t) b.append(''.join(a)) print(len(set(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...
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; set<string> st; for (int i = 0; i < s.length(); i++) { st.insert(s.substr(i) + s.substr(0, i)); } cout << st.size() << "\n"; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 cf745A{ public static void main(String[] args) { Scanner in=new Scanner(System.in); String str=in.next(); int res=0; ArrayList<String> arr=new ArrayList<>(); for(int i=0;i<str.length();i++){ str=str.substring(1,str.length())+str.charAt(0); // System.out.println(...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
# Description of the problem can be found at http://codeforces.com/problemset/problem/745/A s = input() s_s = set() c = 0 while c != len(s): s_s.add(s[len(s) - c :] + s[:len(s) - c]) c += 1 print(len(s_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.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelpe...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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) s+=s print len(set(s[i:i+n] for i in range(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...
# coding: utf-8 difs = set() pal = raw_input() difs.add(pal) restante = ""; for i in range(len(pal)-1, -1, -1): restante = pal[i]+restante pal = pal[:-1] difs.add(restante + pal) print len(difs)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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> p; int main() { string s; cin >> s; int n = s.length() + 1, m = s.length(); p.insert(s); while (n--) { s = s[m - 1] + s.substr(0, m - 1); p.insert(s); } cout << p.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...
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; public class Check2 { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : vec) is >> v; return is; } template <typename T> void dout(string name, T arg) { cerr << arg << endl; } template <typename T1, typename... T2> void dout(string names, T1 arg, T2......
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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=list(input()) y=len(x) c=0 k=list() for i in range(y): g="".join(x) if g in k:pass else: c+=1 k.append(g) f=x[y-1] x.pop(y-1) x.insert(0,f) 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...
def divs(n): result = [1] for i in range(2, n+1): if n % i == 0: result.append(i) return result s = input() n = len(s) lengths = divs(n) for i in lengths: if s == s[:i] * (n//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...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.next(); String next = s; int length = s.length(); for (int i = 0; i < length; i++) { next = next.charAt(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...
s = input() l = [] n = len(s) while(n): n -= 1; if(s not in l): l.append(s) s = s[-1] + s[:len(s)-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...
import java.util.*; import java.io.*; public class HongcowLearnstheCyclicShift { /************************ SOLUTION STARTS HERE ***********************/ private static void solve(FastScanner s1, PrintWriter out){ String str = s1.nextLine(); HashSet<String> set = new HashSet<>(); for(int i=str.lengt...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 in = new Scanner(System.in); String word = in.next(); String palavra = word; int n = word.length(); int total = 0; for(int i = 0; i < n; i++) { word = wo...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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): s = s[-1]+s[0:-1] return s; s = raw_input() l = [s] counter = 0 while counter != len(s): s = shift(s) if s not in l: l.append(s) counter += 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() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int i, j, c = 0; string str, s; cin >> str; j = (int)str.size() - 1; for (i = 0; i < str.size(); i++) { s = str.substr(j, i + 1) + str.substr(0, j); j--; if (s == str) br...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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() st = set() for i in range(len(s)): st.add(s[i:] + s[:i]) 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() b=set() for i in range (len(s)): s=s[-1]+s[:len(s)-1] b.add(s) print (len(b))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s; char c; int cnt = 0; map<string, int> m; cin >> s; for (int i = 0; i < s.size(); i++) { c = s[s.size() - 1]; s = c + s.substr(0, s.size() - 1); m[s]++; if (m[s] == 1) 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() b = set() for i in range(len(a)): s = a[i:] + a[:i] b.add(s) print(len(b))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; string shift(string s) { char tmp = s[s.length() - 1]; for (int i = s.length() - 1; i > 0; i--) s[i] = s[i - 1]; s[0] = tmp; return s; } int cycle(string s) { int count = 0; string tmp = s; while (true) { s = shift(s); if (s == tmp) break; count++;...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const int maxN = 100005; int main() { cin.tie(0); ios_base::sync_with_stdio(0); string s; cin >> s; set<string> ans; for (int i = 0; i < 100; i++) { ans.insert(s); char c = s[0]; s = s.substr(1, s.size()); s += c; } 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...
import java.awt.image.ConvolveOp; import java.io.IOException; import java.sql.Array; import java.util.*; public class First { public static void main(String[] args) throws IOException { Scanner s =new Scanner(System.in); int coun=1; String str=s.nextLine(); s.close(); List<String> AllStr=new ArrayList<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 input, temp(""); set<string> st; cin >> input; for (int i = 0; i < input.size(); ++i) { st.insert(input); temp = input[input.size() - 1]; temp += input.substr(0, input.size() - 1); input = temp; } cout << st.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...
s = input() a = set() for i in range(len(s)): a.add(s[i:] + s[:i]) print(len(a)) # ♥ # قهر نیستم ولی قهرش رو دوس دارم
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() used = set() n = len(s) for i in range(n): gg = s[i:] + s[:i] used.add(gg) print(len(used))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() l = len(s) s = s * 2 ss = set() for i in range(l): ss.add(s[i:i + l]) 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; int main() { string s; cin >> s; int n = s.length(); string a[n]; a[0] = s; for (int i = 1; i < n; i++) { a[i] = a[i - 1][n - 1] + a[i - 1].substr(0, n - 1); } int dem = 0; for (int i = 0; i < n; i++) { if (a[i] != ".") { dem++; for (in...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; import java.util.TreeSet; public class Main { public static InputReader in; public static PrintWriter pw; ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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, v = input(), set() while s not in v: v.add(s) s = s[-1] + s[:-1] print(len(v))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
I = lambda: list(map(int, input().split())) s = input() for i in range(1, len(s)): if s[:i]*(len(s)//i)==s: print(i) quit() 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 A implements Runnable { public StringTokenizer st; public BufferedReader in; public PrintWriter out; public static void main(String[] args) { new Thread(new A()).start(); } public void run() { try { in = new BufferedReader(new InputStreamReader(System.i...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() arr = set() for i in range(len(s)): arr.add(s[i:] + s[:i]) 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...
a = (input()) done = [a] n = len(a) a = list(a) for i in range(n-1): a = [a[-1]] + a[:-1] x = "".join(a) if x not in done: done.append(x) print(len(done))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.*; import java.util.*; import java.lang.*; public class abc{ public static void main(String args[]){ Scanner in=new Scanner(System.in); String z=in.next(); int i,l=z.length(),p=1,j; String []t=new String[l]; t[0]=z; for(i=0;i<l-1;i++){ String z1=z.substring(0,l-1),z2=z.substring(l-1,l); ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner (System.in); String a = input.next(); int l = a.length(); ArrayList<String> b = new ArrayList<String>(); for (int i = l...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.Scanner; public class q2 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); String s=sc.nextLine(); String [] arr=new String[100]; int res=0; //System.out.println(s); for(int i=(s.length()-1);i>=...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
w = input() s = set() for shift in range(len(w)): s.add(w[-shift:] + w[:-shift]) print(len(s))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = raw_input().strip() l = len(s) a = {s[-i:] + s[:-i] for i in range(1, l+1)} print len(a)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int i, n; n = s.length(); string f; f = s + s; cout << f.find(s, 1); return 0; }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQue...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A745 { public static void main(String[] args) { FastScanner sc = new FastScanner(); String in = sc.nextToken...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; 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...
a = input() b = [] k = 0 t = False n = len(a) temp = "" for i in range(n): for j in b: if j == a: t = True if not t: k += 1 b.append(a) temp = a a = "" + temp[n-1] + temp[0:n-1] t = False print(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.io.*; import java.util.*; /** * * @author Sourav Kumar Paul (spaul100) * NIT Silchar */ public class SolveA { public static Reader in; public static PrintWriter out; public static long mod = 1000000007; public static long inf = 100000000000000000l; public static long fac[],inv...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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. */ import java.util.ArrayList; import java.util.Scanner; /** * * @author Ahmed */ public class JavaApplication117 { /** * @...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 x, temp; int n, p = 0, ans = 0; map<string, int> cek; cin >> x; n = x.length(); while (true) { temp = ""; for (int i = p + 0; i < p + n; i++) { temp += x[i]; } if (cek[temp]) break; else { ans++; ce...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
l=list(input()) s=set() for i in range(len(l)): t=l[i:][:] for x in l[:i]: t+=[x] s|={tuple(t)} 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; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); string s; cin >> s; int n = s.size(); set<string> a; a.insert(s); for (int i = 1; i < n; i++) { char c = s[n - 1]; s.insert(s.begin(), c); s.pop_back(); a.insert(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.PrintWriter; import java.util.HashSet; import java.util.Scanner; public class A745 { static Scanner in = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { String word = in.next(); String cword = ""; int...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s1; cin >> s1; set<string> str; str.insert(s1); for (int j = 1; j <= s1.length(); j++) { string s2 = ""; for (int i = 0; i < s1.length() - 1; i++) { s2 += s1[i]; } s2 = s1[s1.length() - 1] + s2; str.insert(s2); s1 ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() n = len(s) S = {s} for i in range(n): s = s[-1] + s[:-1] S.add(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; int main() { string s; cin >> s; stringstream ss; ss << s << s; string u = ss.str(); int n = u.length(); int n1 = s.length(); set<string> se; for (int i = 0; i < n - n1 + 1; i++) { string su = u.substr(i, n1); se.insert(su); } cout << se.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 main() { char s[102]; scanf("%s", s); int n = strlen(s); sscanf(s, "%s", &s[n]); s[n << 1] = '\0'; string ss; map<string, bool> m; int distinct = 0; for (int i = 0; i < n; ++i) { char t = s[n + i]; s[n + i] = '\0'; ss = string(&s[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...
from collections import deque X = deque(input()) Y = set() for i in range(len(X)): Char = X.pop() X.appendleft(Char) Y.add(str(X)) print(len(Y))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 in; set<string> s; int main(int argc, char const *argv[]) { while (cin >> in) { int len = in.length(); for (int i = 0; i < len; i++) { in += in[i]; } for (int i = 0; i < len; i++) { string tmp; for (int j = 0; j < len; 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...
#899A # num = int(input()) # arr = [int(i) for i in input().split()][:num] # one = 0 # two = 0 # for i in range(num): # if arr[i] == 1: # one = one + 1 # elif arr[i] == 2: # two = two + 1 # a = 0 # min1 = 0 # if one >= 1 and two >= 1: # min1 = min(one,two) # a = a + min1 # one = one - mi...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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() cycle={string:1} comp=string for x in range(len(string)): comp=comp[1:]+comp[0] if comp not in cycle: cycle[comp]=1 print(len(cycle))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() myset = set() myset.add(s) for _ in range(len(s)): s = s[1:] + s[0] myset.add(s) print(len(myset))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = raw_input() a = [] for i in range(100): a.append(s) s = s[1:] + s[0] 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...
x=list(input()) y=[] y=x j=0 a=[] while x!=a: a=[] a.append(y[len(y)-1]) i=0 while i<len(y)-1: a.append(y[i]) i=i+1 y=a j=j+1 print(j)