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...
st = raw_input() d = [st] for i in range(len(st)): new_st = st[-1] + st[0:-1] st = new_st if st not in d: d.append(st) 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...
# CF 745/A # 900 def f(s): a = set() for i in range(len(s)): x = s[i:] + s[:i] assert len(x) == len(s) a.add(x) return len(a) assert f("abcd") == 4 assert f("bbb") == 1 s = input() ans = f(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...
text = raw_input() kol = 0 newtext = text while newtext != text or kol ==0 : kol += 1 last = len(newtext) newtext = newtext[last-1] + newtext[:-1] print kol
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s, t; cin >> s; t = s; int A[123] = {0}, ans = 0; for (int i = 0; i < s.size(); i++) { reverse(s.begin(), s.end()); reverse(s.begin() + 1, s.end()); if (s == t) { ans++; break; } else ans++; } cout << ans; ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.Scanner; import java.util.TreeSet; public class Main { static String shift(String s){ s = s.charAt(s.length()-1) + s; s = s.substring(0,s.length()-1); return s; } public static void main(String[] strings) { Scanner sc = new Scanner(System.in); ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { int j = 0, cont = 1, p, check; string s, s1, c, ck[51]; getline(cin, s); s1 = s; ck[0] = s1; for (int k = 0; k < s.size(); k++) { check = 1; int i = s.size() - 1; c = s1[i]; s1.erase(i, 1); s1.insert(j, c); for (p = 0; p <= 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...
def main(): s = input() print(len({''.join(s[i] for i in range(j, j + len(s))) for j in range(1 - len(s), 1)})) if __name__ == '__main__': main()
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { char ch[200]; gets(ch); char ch1[200]; strcpy(ch1, ch); int l = strlen(ch); int count = 0, count1 = 0, j, b = 1; char a[51][200]; while (count != l) { count++; char c = ch[l - 1]; for (j = l - 2; j >= 0; j--) { ch[j + 1] = ch[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.HashSet; import java.util.StringTokenizer; public class A385 { public static void main(String[] args) { FS scan = new FS(); String s = scan.next(); HashSet<String> set = new HashSet<>(); set.add(s); ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = raw_input().strip() d = {} for i in xrange(0, 2 * len(s)): sx = s[i:] + s[:i] d[sx] = True print len(d)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string b; b = s; string t; int sz = s.size(); int ans = 0; while (s != t) { t = ""; t += b[sz - 1]; for (int i = 0; i < sz - 1; i++) { t += b[i]; } ans++; b = t; } cout << ans << endl; retu...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 mult(int x, int y) { long long int ans, x1 = (long long int)x, y1 = (long long int)y; ans = (x1 * y1) % 1000000007; return (int)ans; } int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, int b) { return a * (b / gcd(a, b)); } long long int ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; set<string> st; int l = s.size(); for (int i = 0; i < s.size(); i++) { st.insert(s); for (int j = l; j >= 1; j--) { s[j] = s[j - 1]; } s[0] = s[l]; } cout << st.size() << endl; }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.Scanner; import java.util.ArrayList; public class CyclicShift1 { static Scanner in; static String St; static ArrayList<String> Rotations; static String Rotate(String S) { S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1); return S; } static in...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); string s; cin >> s; set<string> ans; ans.insert(s); string s1 = s.substr(1, s.length() - 1) + s[0]; while (s != s1) { ans.insert(s1); string s2 = s1.substr(1, s1.length() - 1) + s1[0]; s1 = s2; } 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.util.ArrayList; import java.util.List; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String firstWord = scanner.next(); List<String> list = new ArrayList<>(); list.add(firstWord);...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 line = stdin.readline().rstrip() #print(line) s = set() if(len(line)==0): print(0) else: while line not in s: s.add(line) line = line[-1]+line[0:-1] 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(0); map<string, int> m; string str, main_str; int a[26], total = 0; cin >> str; main_str = str; m[main_str]++; int len = str.length(); while (1) { char last_tmp = str[len - 1]; char first_tmp...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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; struct code { int x, y; }; bool comp(code a, code b) {} int64_t bin(int a, int n) { int64_t p = 1; while (n) { if (n % 2 == 0) { a = (a * a) % 10; n /= 2; } else p = (p * a) % 10, n--; } return p; } const int MX = 1e6 + 10; vector<int> 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; int32_t main() { string s; cin >> s; long long n = s.size(); set<string> st; for (long long i = 0; i < n; i++) { st.insert(s); string t; t += s[n - 1]; s.erase(s.begin() + (n - 1)); s.insert(0, t); st.insert(s); } cout << st.size(); 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...
#include <bits/stdc++.h> using namespace std; string rotate1(string s) { for (int i = 1; i < s.size(); i++) swap(s[i - 1], s[i]); return s; } int main() { string a; int c = 0; map<string, int> mp; cin >> a; int x = a.length(); for (int i = 0; i < x; i++) { a = rotate1(a); if (mp[a] == 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 n, from, to, nc, a[100], p[100], c[100], pn[100], cn[100], cnt[100], lcp[100]; char s[100]; int suffix_array() { for (int i = 0; i < (n); ++i) a[i] = s[i] - 'a' + 1; memset(cnt, 0, sizeof(cnt)); for (int i = 0; i < (n); ++i) ++cnt[a[i]]; for (int i = (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...
n = input() l = [] for i in range(len(n)): n = n[-1] + n[:-1] if n in l : continue else : l.append(n) 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[51]; int main() { int tot = 1; cin >> s[1]; int len = s[1].size(); for (int i = 2; i <= s[1].size(); i += 1) { s[i] = s[i - 1]; string ss; ss.resize(1); ss[0] = s[i][len - 1]; s[i].insert(0, ss); s[i].erase(len, 1); int add = 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 static java.lang.System.exit; import java.io.*; import java.util.LinkedHashSet; import java.util.Set; import java.util.StringTokenizer; public class A { static void solve() throws Exception { String s = next(); Set<String> uniques = new LinkedHashSet<>(); int n = 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...
s = input() our = set() for i in range(50): our.add(s) s = s[-1] + s[:-1] print(len(our))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 cycle(k): return k[-1]+k[:-1] k = raw_input() d = {} ans = 0 while True: ans += 1 if k in d.keys(): break d[k] = 1 k = cycle(k) print ans-1
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; set<string> sss; int n; void ulala(string &s) { char ch = s[n - 1]; s.resize(n - 1); string temp = ""; temp += ch; temp += s; s = temp; sss.insert(s); } int main() { string s; cin >> s; n = s.size(); sss.insert(s); for (int i = 0; i < n; i++) ulala(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...
def shift(l, n): return l[n:] + l[:n] input = raw_input() temp = {} for i in range(len(input)): temp[shift(input, i)] = 1 print len(temp)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); String orig = new String(str); int count = 1; do { str = String.valueOf(str.charAt(str.length()-1)).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.Scanner; public class A { public static void main(String[] args) { String s; String s1; int count = 0; Scanner input = new Scanner(System.in); s = input.nextLine().toLowerCase(); s1 = s; 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...
import java.io.InputStream; import java.io.PrintStream; import java.util.HashSet; import java.util.Scanner; import java.util.Set; /** */ public class MainA { public static void main(String[] args) { run(System.in, System.out); } public static void run(InputStream in, PrintStream out) { try (Scanner sc = new...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.*; import java.util.HashSet; import java.util.StringTokenizer; public class Code1_385 { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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; long long i, j; long long n = s.size(); set<string> se; se.insert(s); for (i = 1; i < n; i++) { s = s.substr(n - 1, 1) + s.substr(0, n - 1); se.insert(s); } cout << se.size() << endl; return 0; }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; string lt[50]; int main() { int sum = 0, c = 0; string s; cin >> s; for (int i = 0; i < (int)s.size(); i++) { lt[i] = s.substr((int)s.size() - i, i) + s.substr(0, (int)s.size() - i); sum++; } sort(lt, lt + sum); for (int i = 0; i < sum - 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...
import java.util.Scanner; import java.util.stream.IntStream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); System.out.println(solve(s)); sc.close(); } static int solve(String s) { return (int) IntStream.range(0, s.length()).mapTo...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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> Set; int main() { string s; cin >> s; int n = s.size(); for (int i = 0; i < n; i++) { s = s.substr(1, n - 1) + s.substr(0, 1); Set.insert(s); } printf("%d\n", Set.size()); return 0; }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s[55], r; char c; long long i, n, j; cin >> r; s[0] = r; for (i = 0; i < r.size() - 1; i++) { c = r[r.size() - 1]; for (j = r.size() - 2; j >= 0; j--) { r[j + 1] = r[j]; } r[0] = c; s[i + 1] = r; } long long 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; int main() { string str; cin >> str; set<string> st; st.insert(str); int len = str.length(); for (int i = 0; i <= len; ++i) { char pre = str[0]; for (int i = 1; i <= len - 1; ++i) { char ch = str[i]; str[i] = pre; pre = ch; } 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...
n=input() l=[n] x=len(n) for i in range(x): z="" n=n[x-1]+n[:x-1] l.append(n) 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...
s = input() n = len(s) t = {} t[s] = True for i in range(n): s = s[1:] + s[0] t[s] = True print(len(t))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() total = set() for i in range(0, len(s)): total.add(s[i:] + s[:i]) print(len(total))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
def inp(): return int(raw_input().strip()) def inp_arr(): return map(int, (raw_input().strip().split())) def principal_period(s): i = (s + s).find(s, 1, -1) return None if i == -1 else s[:i] st = raw_input().strip() p = principal_period(st) if p is None: print len(st) else: print len(p)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> const int INF = 1e6; using namespace std; const int maxn = 1e5 + 5; const int N = 1e6; map<string, int> m; int main() { ios::sync_with_stdio(0); cin.tie(0); int i, ans = 0; string a; cin >> a; int l = a.length(); for (i = 0; i < l; i++) { string temp = a.substr(l - 1) + a.subs...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 = [] 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() ans = lambda a: len({a[i:] + a[:i] for i in range(len(a))}) print(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...
#!/usr/bin/env python3 def main(): w = input() words = set() for i in range(len(w)): words.add(w[i:] + w[:i]) return len(words) if __name__ == '__main__': print(main())
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; const long long int mx = INT_MAX; const long long int mn = INT_MIN; const long long int mv = 1000005; const long long int pi = 3.141592653589793238462643; string a, b[55], c, h; long long int d, e, f, g; set<string> l; int main() { ios_base::sync_with_stdio(NULL); cin.t...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long n) { if (a == 0) return 0; if (a == 1 || n == 0) return 1; if (n == 1) return a % 1000000007; long long t = power(a, n / 2); t = t * t % 1000000007; if (n & 1) return t * a % 1000000007; return t; } int popcount(long long...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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> myset; int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { string t; for (int j = i; j < s.size(); j++) t += s[j]; for (int j = 0; j < i; j++) t += s[j]; myset.insert(t); } cout << myset.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...
a=input() m=set([]) for i in range(len(a)): x=a[i:]+a[:i] m.add(x) print(len(m))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
a = [] str = input() for k in range(len(str)): s = "" s += str[len(str) - 1] for i in range(0, len(str) - 1): s += str[i] a.append(s) str = s a = set(a) print(len(a))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string t = ""; set<string> st; st.insert(s); for (int i = 1; i < s.length(); i++) { t = s.substr(i, s.length() - i) + s.substr(0, i); st.insert(t); } cout << st.size() << endl; }
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() t = set() N = len(s) t.add(s) for i in range(N): s = s[1:] + s[0] t.add(s) print(len(t))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() i = 1 d = {} d[s] = 1 while (i<=len(s) + 1): s = s[len(s) - 1] + s[:-1] #print(s)yz d[s] = 1 i+=1 print(len(d))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
from copy import copy s=input() used=[] used.append(s) p=1 for i in range(len(s)): s=s[len(s)-1]+s[:-1:] if s not in used: p+=1 used.append(s) print(p)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
from sys import stdin,stdout,setrecursionlimit,maxint,exit #setrecursionlimit(10**5) def listInput(): return map(long,stdin.readline().split()) def printBS(li): for i in xrange(len(li)-1): stdout.write("%d "%li[i]) stdout.write("%d\n"%li[-1]) def sin(): return stdin.readline().rstrip() s=sin() n=len(s) se=set([])...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() l = [] for i in range(len(s)): s = s[len(s)-1] + s[0:len(s)-1] l.append(s) print(len(set(l)))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s=input() tool=len(s)-1 tmp={s:1} ans=1 for i in range(tool,0,-1): s=s[tool]+s[:tool] if tmp.get(s,-1)==-1: tmp[s]=1 ans+=1 print(ans) ''' abcd dabc cdab bcda abcd '''
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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 = [] n = len(s) for i in xrange(n): a.append(s[n-i:]+s[:n-i]) 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...
s = input() n = len(s) i = 0 a = [] while i < 50: s = s[-1] + s[:n-1] if s not in a:a.append(s) i += 1 print(len(a))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> #pragma GCC optimize("-O3") using namespace std; const int N = 1e3 + 5; int n; string s, t; unordered_set<string> M; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> s, n = s.length(); for (int i = 0; i < n; i++) { t += s[n - 1]; for (int j = 0; 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...
string = input() def cyclicshift(string): ans = set() n = len(string) for i in range(n): ans.add(string[i:]+string[:i]) return ans ans = cyclicshift(string) print(len(ans))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = list(input()) words = [] words.append("".join(s)) for a in range(len(s)): s.insert(0, s[-1]) s.pop(-1) words.append("".join(s)) print(len(set(words)))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; string str, tmp; set<string> st; int main() { ios::sync_with_stdio(false); while (cin >> str) { st.clear(); int len = str.length(); for (int i = 0; i < len; ++i) { st.insert(str); str = str.substr(1, len - 1) + str[0]; } cout << 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...
s=input() n=len(s) a=[] for i in range(n-1): k=s[i+1:]+s[:i+1] if k==s: break else: a.append(k) print(len(a)+1)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
l=list(input()) s="".join(l) d=[] d.append(s) for i in range(len(l)): l.append(l[0]) l.pop(0) s="".join(l) 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...
my_str = input() my_list = list(my_str) ans_list = [my_str] for i in range(1,len(my_str)): temp = my_list.pop() my_list.insert(0,temp) ans_list.append("".join(my_list)) my_set = set(ans_list) print(len(my_set))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); String s=sc.next(); String f=s.concat(s); System.out.print(f.indexOf(s,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...
a=input() n=len(a) l=[] l.append(a) while(n>0): s="" s=s+a[n-1]+a[:-1] if s not in l: l.append(s) else: break a=s n1=len(l) print(n1)
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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() strs = [] for i, v in enumerate(s): strs.append(s[-i:] + s[: -i]) print len(set(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...
#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 - 1) + s.substr(0, 1); while (dup != s) { s = s.substr(1, len - 1) + s.substr(0, 1); ct++; } cout << ct << endl; } int main() { ios_base::sync_with_...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashSet; public class A385 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // int n = Integer.parseInt(br.readLine()); // StringTokenizer st; =...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { string s, s1 = ""; int c; map<char, int> m; cin >> s; s1 = s; s1 += s; c = s1.find(s, 1); cout << c << 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...
word = raw_input() print len({word[i:] + word[:i] for i in range(len(word))})
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int n = s.length(); int ans = s.length(); for (int i = 1; i <= s.length(); i++) { bool b = 1; for (int j = 0; j < n; j++) if (s[j] != s[(j + i) % n]) b = 0;...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
from collections import Counter s=input() i=len(s)-1 h=i+1 x=s ans=0 r=set() while i>=0: x=s[i]+x x=x[:h] r=r|{x} #print(x) i-=1 print(len(r))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; long long i, k, j; string s, w, q; map<string, int> us; int main() { cin >> s; for (i = 0; i < s.size(); i++) { w = ""; q = ""; for (j = 0; j < s.size() - i; j++) w += s[j]; for (j = s.size() - i; j < s.size(); j++) q += s[j]; w = q + w; if (us[w...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.Arrays; import java.util.Scanner; public class B { private static int len; private static String getNewString(String str){ return str.substring(len-1) + str.substring(0, len-1); } public static void main(String[] argv){ Scanner sc = new Scanner(System.in); S...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; long long arr[1000000]; vector<int> vec[10000]; int dist[10000]; int dfs(int node, int leaf, int depth) { dist[node] = depth; for (int i = 0; i < vec[node].size(); i++) { int next = vec[node][i]; if (vec[node][i] == leaf) continue; if (dist[vec[node][i]]) 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...
import itertools import math from collections import defaultdict def input_ints(): return list(map(int, input().split())) def solve(): s = input() n = len(s) ans = set() for i in range(n): ans.add(s) s = s[-1] + s[:n-1] print(len(ans)) if __name__ == '__main__': 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.Scanner; public class A { static Scanner scan = new Scanner(System.in); static String nextString() { return scan.next(); } static int nextInt() { return Integer.parseInt(nextString()); } public static void main(String[] args) { String s = nextString...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.util.*; import java.lang.*; import java.io.*; public class Checker { static int imax=Integer.MAX_VALUE,imin=Integer.MIN_VALUE; static long lmax=Long.MAX_VALUE,lmin=Long.MIN_VALUE; static long mod=(long)1e9+7; public static void main (String[] args) throws java.lang.Exception { InputReader in =new I...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> int main() { int i, j, count = 1, l; char cp[52], mn[52], temp, temp1, last; while (gets(mn)) { count = 0; l = strlen(mn); strcpy(cp, mn); for (j = 0; j < l; j++) { count++; temp = mn[0]; last = mn[l - 1]; for (i = 0; i < l - 1; i++) { temp1...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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.ArrayList; import java.util.HashSet; import java.util.StringTokenizer; public class MyCode { public static void main(String[] args) throws IOException { in.init(System.in); String s=in.next(); String s1=s; int f=s.length(); int count =...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.BufferedReader; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.util.ArrayList; imp...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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() temp=[] temp.append(s) l=len(s) for i in range(0,l): p="" for j in range(1,l): p=p+s[j]; p=p+s[0] s=p if(p not in temp): temp.append(p) print(len(temp))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
shift = lambda s,i: s[i:] + s[:i] s = raw_input() print len(set(shift(s,i) for i in xrange(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...
#from __future__ import division import itertools from fractions import gcd from math import sqrt from bisect import bisect_left import heapq def Ls(): return list(raw_input()) def get(a): return map(a , raw_input().split()) def Int(): return int(raw_input()) def Str(): return raw_input() #######################_...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
# import sys # sys.stdin=open("input.in",'r') # sys.stdout=open("out.out",'w') a=input() s=set() i=0 s.add(a) x="" while x!=a: x=a[i+1:]+a[0:i+1] s.add(x) i+=1 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; void swapi(int *a, int *b) { int temp; temp = *a; *a = *b; *b = temp; } unsigned long long gcd(unsigned long long a, unsigned long long b) { if (a == 0) return b; if (b == 0) return a; if (a == 1 || b == 1) return 1; if (a == b) return a; if (a > b) 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; const long long MOD = 1e9 + 7; const long long INF = 1e18; const int MAXN = 2e5 + 1; const int MAXM = 9e4 + 500; const int N = 500 + 5; const double EPS = 1e-9; int dx[] = {-1, 1, 0, 0}; int dy[] = {0, 0, 1, -1}; int i, j, d; long long n, k, m; int main() { ios_base::sync...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
#include <bits/stdc++.h> using namespace std; int main() { set<string> s; string s1; int c = 0, i; getline(cin, s1); int lan = s1.size(); for (i = 0; i < s1.size(); i++) { s1 = s1[lan - 1] + s1.substr(0, lan - 1); s.insert(s1); } cout << s.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...
s = input() res = set() for i in range(len(s)): l = i + len(s) sc = s[i:l] + s[0:i] res.add(sc) print(len(res))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() res = set() for i in range(len(s) + 5): s = s[1:] + s[0] res.add(s) print(len(list(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...
a = raw_input() b = {} b[a] = 1 for i in range(0,len(a)-1): a = a[1:] + a[0:1] b[a] = 1 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...
def Cycle(s): return s[-1] + s[:len(s) - 1] s = input() a = [s] while Cycle(s) not in a: a.append(Cycle(s)) s = Cycle(s) print(len(a))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.NoSuchElementException; public class A { String s; public void solve() { s = next(); HashSet<String> set = new HashSet<String>(); for(int i = 0;i < s.length();i++){ StringBuilder ...
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try 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=[s] for i in range(len(s)-1): s=s[-1]+s[:len(s)-1] l.append(s) print(len(set(l)))
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c...
s = input() n = len(s) a = set() for i in range(n): a.add(s[i:] + s[:i]) print(len(a))