prompt string | response string |
|---|---|
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... |
/*
* Author- Kishan_25
* BTech 2nd Year DAIICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;
public class code {
private static InputStream stream;
private static byte[] bu... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
long long BigMod(long long B, long long P, long long M) {
long long R = 1;
while (P > 0) {
if (P % 2 == 1) {
R = (R * B) % M;
}
P /= 2;
B = (B * B) % M;
}
return R;
}
using namespace std;
bool dont[1005];
int main() {
int n;
cin >> n;
string str;
cin >> str... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=input()
s=raw_input()
q=0
w=0
a=[0]
i=0
while i<n:
if s[i]=="_":
a+=[q]
q=0
elif s[i]=="(":
a+=[q]
q=0
i+=1
while s[i]!=")":
if s[i]!="_"and (s[i+1]=="_" or s[i+1]==")"):
w+=1
i+=1
else:
q+=1
i+=1
a=a+[q]
print str(max(a)), str(w)
|
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
len_out, count_in = 0, 0
balance, cur = 0, 0
for c in input():
if not (('a' <= c <= 'z') or ('A' <= c <= 'Z')) and cur:
if balance:
count_in += 1
else:
len_out = max(len_out, cur)
cur = 0
if c == '(':
balance += 1
elif c == ')':
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
in_paren = False
words = 0
mx = 0
j = 0 #length of current word
for i in s:
if i == "_":
words += 1 if in_paren and j else 0
if not in_paren:
mx = max(mx, j)
j = 0
elif i == "(":
in_paren = True
mx = max(mx, j)
j = 0
el... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.PrintWriter;
import java.util.Scanner;
/**
*
* @author seka
*/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String s = in.next();
int h = 0;
int st = 0;
int cnt1 = 0;
int ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
flag = 0;
count = 0;
ans = 0;
for c in s:
if flag == 0:
if c == '(':
flag = 1;
ans = max(count, ans);
count = 0;
elif c == '_':
ans = max(count, ans);
count = 0;
else:
count += 1;
else:... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int toNumber(string s) {
int Number;
if (!(istringstream(s) >> Number)) Number = 0;
return Number;
}
string toString(int number) {
ostringstream ostr;
ostr << number;
return ostr.str();
}
int main() {
long long n;
string s;
vector<long long> v;
cin >> n ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
static Scanner in = new Scanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(Strin... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
l = 0
max_l = 0
count = 0
word = False
inside = False
LETTERS = 'qwertyuiopasdfghjklzxcvbnm'
def getSplitWords(s):
return [x for x in s.split('_') if x]
def getBrackets(s):
ans = []
while '(' in s:
ans.append(s[s.rfind('(')+1:s.find(')',s.rfind('('))])
s = s[:s.... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int ans1 = 0, ans2 = 0;
vector<string> t1, t2;
string s1 = "";
for (int i = 0; i < n; ++i) {
if (s[i] == '_') {
s[i] = ' ';
}
if (s[i] == '(' || s[i] == ')') s[i] = '\n';
}
stringstream ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | input()
s = input()
ans = [ "", "" ]
cur = 0
for c in s:
if c == '(':
ans[cur]+='_'
cur+=1
elif c == ')':
ans[cur]+='_'
cur-=1
else:
ans[cur] += c
for i in range(2):
ans[i] = ans[i].split('_')
# print(ans[0])
# print(ans[1])
print(max([0] + [len(w) for w in ans... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=int(input())
S=input()
k=0
d=0
m=0
ma=-1000000
for i in range(len(S)) :
if S[i]!='_' and S[i]!='(' and S[i]!=')' and d==0 :
m=m+1
else :
if S[i]=='_' and d==0 or S[i]=='(' and d==0 or S[i]==')' and d==0 :
if ma<m :
ma=m
m=0
if S[i]!='_' and S[i]!='('... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = input()
inp = raw_input()
st = []
cl = []
for i in xrange(n):
if(inp[i]=='('):
st += [i]
elif(inp[i]==')'):
cl += [i]
br = len(st)
B = 0
for i in xrange(br):
temp = inp[st[i]+1:cl[i]]
temp = temp.split('_')
for j in temp:
if(len(j)!=0):
B += 1
A = 0
for i in x... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | N = int(input())
S = input()
while len(S) > 0 and S[0] == '_':
S = S[1:]
while len(S) > 0 and S[-1] == '_':
S = S[:-1]
N = len(S)
D = []
P = []
t = ''
i = 0
while i < N:
if S[i] == '(':
D.append(t)
t = ''
i += 1
while i < N and S[i] != ')':
t += S[i]
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import re
a=raw_input()
s=raw_input()
pat= re.compile('\([\w|_]*\)')
pat1=re.compile('_+')
ss= re.split(pat1,re.sub(pat,'_',s))
ret = 0
for sss in ss:
ret=max(len(sss),ret)
pat=re.compile('\([\w|_]+\)')
ret1=0
objs= pat.findall(s)
for x in objs:
#print x
#print re.split('_+',x[1:-1])
#print re.split('_+... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
bool isalpha(char ch) {
if (ch >= 'a' && ch <= 'z') return true;
if (ch >= 'A' && ch <= 'Z') return true;
return false;
}
int findwords(string str, int now) {
while (isalpha(str[now])) now++;
return now - 1;
}
int main() {
string str;
int T;
while ((scanf("%... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | def main():
input()
l = [s for p in input().split('(') for s in p.split(')')]
print(max(map(len, (w for s in l[::2] for w in s.split('_')))),
len([w for s in l[1::2] for w in s.split('_') if w]))
if __name__ == '__main__':
main()
|
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #!/usr/bin/python
import sys
long_word = 0
word_in_parent = 0
line_length = sys.stdin.readline()
line = sys.stdin.readline()
flags = {'in_parent':0, 'word_len':0}
for char in line:
if char == '_' or char == '(' or char == ')' or char == "\n":
if flags['in_parent'] == 0 and flags['word_len'] > long_word... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
/* Codeforces Round #375 (Div. 2)
* Text Document Analysis
* @author : ragh... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int maxi = 0;
int main() {
int n;
cin >> n;
string s;
cin >> s;
bool flag = 0;
int counter = 0;
for (int i = 0; i < n;) {
if (s[i] == '(') {
flag = 1;
i++;
} else if (s[i] == '_')
i++;
else if (s[i] == ')') {
flag = 0;
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | if __name__ == "__main__":
length = int(raw_input())
string = list(raw_input().strip())
inners, outers = ["_"], ["_"]
inb = False
for ch in string:
if ch == "(":
inb = True
inners.append("_");
outers.append("_");
continue
if ch == ")":
inb = False
inners.append("_")
outers.append("_")
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(nullptr);
cout.tie(nullptr);
string s, str = "";
int n;
int bal = 0, cnt1 = 0, cnt2 = 0;
cin >> n;
cin >> s;
s.push_back('_');
reverse((s).begin(), (s).end());
s.push_back('_');
reverse((s).begin(), (s).e... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int main() {
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n, r1 = 0, r2 = 0;
string s, t = "";
cin >> n >> s;
bool in = 0;
for (int i = (0); i < ((int)s.size()); i++) {
if (isalpha(s[i]))... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
static int n;
static int i;
static char b[];
public static void main(String[] args) {
Scanner in=new Scanner(new BufferedInputStream(System.in));
n=in.nextInt();
String s=in.next();
b=s.toCharArray();
int ans=0;
int num=0;... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input().replace("__", "_").replace("_", " ")
ans_1 = 0
ans_2 = 0
fl = False
t_1 = 0
t_2 = 0
n = len(s)
for i in range(n):
if s[i] == "(":
fl = True
if i+1 < n and s[i+1].isalpha():
t_2 += 1
t_1 = 0
elif s[i] == ")":
fl = False
ans_2 = max(... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #!/usr/bin/env python3
n = int(input())
s = input()
p, w = False, False
x, y, z = 0, 0, 0
for c in s:
if c == '_':
w = False
x = 0
elif c == '(':
p = True
w = False
x = 0
elif c == ')':
p = False
w = False
x = 0
else:
x += 1
if not p and x > y:
y = x
if p and... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | def B():
bra = False
braWord = False
nIn = 0
worOut = [0] * 256
nOut = 0
n = int(input())
str = list(input())
for i in range(n):
if not bra:
if str[i] == "_":
nOut += 1
elif str[i] == "(":
nOut += 1
bra = Tr... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
const int INF = int(1e9);
const long long INFll = 1ll * INF * INF;
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
s += '_';
n++;
int i = -1;
int k = 0, ans1 = 0;
string r = "";
while (i < n) {
i++;
if (s[i] == '(') {
if (r.size() != 0) {... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
#def solve(firstLine):
def solve(lines):
wordsSet = set()
wordMax = 0
inWords = 0
inParent = False
noParent = 0
inSidx = 0
sidx = 0
for idx, ch in enumerate(lines):
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
const int N = 100008;
bool prime[N];
int arr[N];
bool isprime(int n) {
if (n <= 1) return 0;
for (int i = 2; i * i <= n; i++)
if (n % i == 0) return false;
return prime[n] = true;
}
void feilprime() {
prime[0] = prime[1] = 0;
for (int i = 2; i * i <= 300; i++)... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | from re import split
trash=input()
n=input()
par=""
while "(" in n:
par=par+n[n.find("("):n.find(")")+1]
n=n[:n.find("(")]+"_"+n[n.find(")")+1:]
para=split("[\\(\\)_]+",par)
na=split("_+",n)
while '' in para:
para.remove('')
while '' in na:
na.remove('')
ou=""
max=0
for x in na:
if max<len(x):
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
f = False
lword = 0
wcont = 0
res = 0
for i in range(n):
if s[i].isalpha() and f == False:
lword += 1
if i == n-1:
if lword > res:
res = lword
lword = 0
elif s[i] == "_" and f == False:
if lword > res:
res =... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = input()
s = raw_input().strip().replace(')','(').split('(')
a,b = list(),list()
for i in range(len(s)):
if i%2==0:
a.append(s[i])
else:
b.append(s[i])
a = [i.split('_') for i in a]
a = [x for sublist in a for x in sublist]
a[:] = [x for x in a if x != '']
b = [i.split('_') for i in b]
b = [x for sublist in b ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import itertools
from fractions import gcd
from math import sqrt
from bisect import bisect_right
#headache
def get(a):
return map(a , raw_input().split())
def I():
return int(raw_input())
def Str():
return raw_input()
n = input()
har = raw_input()
ansi = ""
ansj = ""
resi , resj = 0, 0
fg = False
for i in har:
if... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n, = map(int, raw_input().split(" "))
st = raw_input()
isin = 0
a = [0,0]
t = 0
for ch in st:
if ch in ('(',')'):
if isin == 0:
a[isin] = max(a[isin], t)
elif t:
a[isin] += 1
t = 0
if ch == ')':
isin = 0
else:
isin = 1
elif ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = raw_input()
str = raw_input()
str = str.replace('(', '_(')
str = str.replace(')', ')_')
parentheses = []
remaining = ""
forParent = False
for indx, x in enumerate(str):
if x == '(':
forParent = True
stIndx = indx
if x == ')':
forParent = False
parentheses.append(str[stIndx +... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import re
l = int(input())
s = input()
s_clean = re.sub(r"_+", " ", s.lower())
s_clean = s_clean.replace("(", " ( ")
s_clean = s_clean.replace(")", " ) ")
s_list = s_clean.split()
def find_larget(l):
largest = 0
for st in l:
if len(st) > largest:
largest = len(st)
return largest
de... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int n;
bool ok = 1;
int maxx = -1, maxxx, cur = 0;
string s;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
cin >> s;
for (int i = 0; i < n; ++i) {
if (s[i] == '_') {
if (ok) maxx = max(maxx, cur);
if (!ok) maxxx += (cur !=... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=int(input())
text= input()[:n]
# words_with_paren=input().split('_')
len_long_word_out=0
numb_words_in_paren=0
if '(' in text:
open_ind = [i for i, x in enumerate(text) if x == "("]
close_ind= [i for i, x in enumerate(text) if x == ")"]
for (i,offset) in enumerate(open_ind):
tmp... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | input()
s = raw_input().replace(')', '(').split('(')
inside = False
num = 0
maxL = 0
for t in s:
for l in t.split('_'):
if inside:
if len(l) > 0: num = num + 1
else:
maxL = max(maxL, len(l))
inside = not inside
print maxL, num
|
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
const int M = 1000000007;
string s;
bool ltr(int i) {
if (s[i] >= 'a' && s[i] <= 'z') return true;
if (s[i] >= 'A' && s[i] <= 'Z') return true;
return false;
}
int main() {
int n, a = 0, b = 0, cur = 0;
cin >> n >> s;
bool f = false;
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
static StringBuilder a = new StringBuilder(... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int N;
string S;
cin >> N >> S;
S += '_';
int ans1 = 0;
int ans2 = 0;
int pre = -1;
bool inKakko = false;
for (int i = 0; i <= N; i++) {
if (S[i] == '(' || S[i] == ')' || S[i] == '_') {
if (pre != -1) {... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline().strip()
ans = [0, 0]
label = 0
cnt = 0
for i in range(len(s)):
if s[i] == '(':
ans[0] = max(ans[0], cnt)
label = 1
cnt = 0
elif s[i] == ')':
if cnt:
ans[1] += 1
label = 0
cn... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.*;
import java.math.*;
import java.lang.*;
import java.io.*;
public class c2
{
//static int MOD = 1000000009;
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
int n = in.read... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
words = 0
best = 0
cur = 0
i = 0
while i < n:
if s[i] == "(":
x = i
while s[i] != ")":
i += 1
i += 1
for word in s[x+1:i-1].split("_"):
if len(word) > 0:
words += 1
elif s[i] == "_":
while s[i] == "_":
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k = 1, a = 0, b = 0, w = 0, max = 0;
string s;
cin >> n;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '(') k = 0;
if (s[i] == ')') k = 1;
if ((s[i] >= 'a' && s[i] <= 'z' && k == 0) ||
(s[i] >= 'A' && s[i] <= 'Z' && k ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
long long ar[1000009], pr[1000009], ap[1000009];
vector<long long> vec, vecc;
map<long long, long long> mymap;
string aa, dd, ff, gg;
char ss[1000009];
vector<pair<long long, long long> > KEEP;
int main() {
long long i, j, k, l, n, m, ind, sum, tot, temp, flag, ans, now, ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
const long double ACOSPI = (acosl(-1.0));
using namespace std;
struct tree {
int l;
int r;
int cost;
};
struct zero {
int l;
int r;
int n;
};
int main() {
string s;
int i = 0;
int incnt = 0;
int maxl = 0;
int curr = 0;
bool in = false;
cin >> i;
cin >> s;
int len =... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
k = input().strip() + '_'
ans1 = 0
ans2 = 0
cnt1 = 0
cnt2 = 0
_in = 0
p = '_'
for i in k:
if _in:
if i == ')':
_in = 0
if ((i == '_' or i == ')') and (p != '_' and p != '(')):
ans2 += 1
p = i
else:
if (i == '('):
if (p != '_' a... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
int n;
scanf("%d", &n);
char str[n + 10];
scanf("%s", str);
string s = str;
bool mode = false;
int max_len = 0, cnt = 0;
int words = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '(') {
mode = true... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
string lower(string s) {
for (int i = 0; i < s.length(); i++) s[i] = (char)tolower(s[i]);
return s;
}
string upper(string s) {
for (int i = 0; i < s.length(); i++) s[i] = (char)toupper(s[i]);
return s;
}
long long int gcd(long long int a, long long int b) {
if (b ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class SolutionD
{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | a=input()
s=list(input())
i=0
ss=sc=max1=0
fal=0
for i in range(len(s)):
if s[i]=='_':
sc=0
if s[i]=='(':
fal+=1
sc=0
if s[i+1]!=')' and s[i+1]!='_':
ss+=1
if (fal==0) and s[i]!='_' and s[i]!=')'and s[i]!='(':
sc=sc+1
if sc>max1:
m... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=int(input())
s=input()
m=0
ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
def nextstr(s,start):
i=start
while i<len(s) and s[i] in ch:
i+=1
return i-1
i=0
c=0
while i<n:
if s[i]=="(":
i+=1
while s[i]!=")":
if s[i]=="_":
i+=1
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.*;
import java.math.BigInteger;
/**
*
* @author Pradyumn Agrawal coderbond007
*/
public class Hackerrank{
public static InputStream inputStream = System.in;
public static OutputS... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | value=int(input())
string=input()
string=string.lower()
pam="abcdefghijklmnopqrstuvwxyz"
outside=[]
inside=[]
count=0
wait=0
for it in string:
if wait==0:
if it=="_":
outside.append(count)
count=0
elif it=="(":
outside.append(count)
count=0
wait=1... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int len;
cin >> len;
char input[300];
cin >> input;
int outside = 0;
int inside = 0;
int count = 0;
int num = 0;
bool bracket = false, counting = false;
for (int idx = 0; idx <= len - 1; idx++) {
if ((input[idx] != '_') && (input[idx] !=... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | b=int(input())
a=input()
c=0
xiahuan=0
kuohao=0
danci=0
zimu=0
maxn=0
while(c<b):
if(a[c]=="("):
kuohao=1
if(a[c]==")"):
kuohao=0
if(kuohao==0):
if((a[c]>='A' and a[c]<='Z') or (a[c]>='a' and a[c]<='z')):
zimu=zimu+1
if(maxn<zimu):
maxn=zimu
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | def main():
n = int(input())
text = input()
outside = ''
inside = ''
is_inside = False
for c in text:
if c == '(':
is_inside = True
outside += '_'
inside += '_'
continue
if is_inside and c != ')':
inside += c
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Stack;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @a... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
flag = False
maxW = 0
wC = 0
gg = 0
for i in range(n):
if s[i] == '(':
flag = True
maxW = max(gg,maxW)
gg = 0
elif s[i] == ')':
flag = False
if i > 0 and s[i-1] != '_' and s[i-1] != ')' and s[i-1] != '(':
wC += 1
elif s[i] == '_':
if i > 0 and s[i-1] != '_' and s[i-1] != ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | from collections import defaultdict
import sys, os, math
if __name__ == "__main__":
n = int(input())
s = input()
flag = False
ln,cnt = 0,0
s1 ,s2 = "",""
for i in range(n):
if s[i] == '(':
flag = True
s1 += '_'
s2 += '_'
elif s[i] == ')':
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class B {
public static void main(String[] args) throw... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | input()
s = input() + '_'
wr = 0
sep = 0
curr = 0
mx = 0
cnt = 0
for el in s:
if el == '(':
mx = max(mx, curr)
wr = 1
curr = 0
if el == ')':
if curr != 0:
cnt += 1
curr = 0
wr = 0
if el == '_':
if wr == 0:
mx = max(mx, curr)
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.*;
import java.io.*;
public class code723B
{
public static void main(String[] args) throws Exception{
BufferedReader bff=new BufferedReader(new InputStreamReader(System.in));
BufferedWriter wff=new BufferedWriter(new OutputStreamWriter(System.out));
bff.readLine();
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 collections import Counter
s = input()
counter = Counter()
for i in range(len(s)):
counter[s[i:len(s)] + s[0:i]] = 1
print(sum(counter.values())) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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.HashMap;
import java.util.Scanner;
public class Stone {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
sc.close();
int l = s.length();
HashMap<String, Boolean> hm = new HashMap<String, Boolean>();
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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()
s = set([ word[i:] + word[:i] for i in range(len(word)) ] )
print(len(s))
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
s2 = ''
k = len(s) - 1
count = 0
while k >= 0:
if s == s2:
break
elif s2 == '':
s2 = s
s = s[len(s) - 1] + s[:len(s) - 1]
k -= 1
# print(s)
count += 1
print(count)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
sset = set([s])
res=1
for i in range(len(s)-1):
s = s[-1]+s[0:-1]
if not s in sset:
sset.add(s)
res+=1
print(res)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=str(input())
l=set()
for i in range(0,len(s)):
e=s[-1]+s[0:len(s)-1]
s=e
l.add(e)
print(len(l)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | S = raw_input()
T=S+S
for i in xrange(1,len(T)):
if T[i:i+len(S)]==S:
break
print i |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | def res(a):
b = a[-1]
a = a[:-1]
a = b + a
return a
a = str(input())
ans = 1
b = []
b.append(a)
for i in range(len(a)-1):
a = res(a)
if a not in b: ans += 1; b.append(a)
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... | inp = str(raw_input())
temp = []
count = 0
for i in range(0,len(inp)):
inp = inp[-1] + inp[0:-1]
if inp not in temp:
count+=1
temp.append(inp)
print count |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> str;
str.insert(s);
int n = s.size();
while (n--) {
s.insert(s.begin(), s[s.size() - 1]);
s.erase(s.end() - 1);
str.insert(s);
}
cout << str.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... | "Hongcow learns the cyclic shift"
s = raw_input()
already_used = [s]
for i in range(len(s)):
temp = s[len(s)-1]
temp += s[:len(s)-1]
if temp in already_used:
pass
else:
already_used.append(temp)
s = temp
print len(already_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()
res = 1
buf = s[-1] + s[:len(s) - 1]
while (buf != s):
res += 1
buf = buf[-1] + buf[:len(buf) - 1]
print(res, end = '') |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 org.w3c.dom.ls.LSOutput;
import java.util.ArrayList;
import java.util.Scanner;
public class HongcowLearnsTheCyclicShift {
public static boolean isElementOf(ArrayList<String> list, String s) {
for (int i = 0; i < list.size(); i++) if (s.equals(list.get(i))) return true;
return false;
}
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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 maxn = 55;
string str;
int main() {
cin >> str;
map<string, int> m;
m[str]++;
int len = str.size();
for (int i = 0; i < len; i++) str += str[i];
for (int i = 0; i < len; i++) {
m[str.substr(i, len)]++;
}
cout << m.size() << endl;
return 0;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s=input()
s1=list(s)
l=[s]
while(1):
a=s1[len(s1)-1]
for i in range(len(s1)-1,0,-1):
s1[i]=s1[i-1]
s1[0]=a
s2=''.join(s1)
if s2 not in l:
l.append(s2)
elif s2==s:
break
print(len(l)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = raw_input()
se = set()
n = len(s)
for i in xrange(len(s)):
se.add(s[n-i-1:]+s[:n-i-1])
print len(se)
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.util.*;
import java.io.*;
public class A745 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String s = in.nextLine();
int n=s.length(),r=-1,count=0,k=0,p=0;
if(n==1)
{
System.out.println(n);
}
else
{
for(int j=1;j<=(n/2)+1;j++)
{
if(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()
d = {}
ans = 1
d[s] = 1
for i in range(len(s)):
s = s[-1] + s[0:-1]
if (s not in d):
d[s] = 1
ans += 1
print(ans) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
set<string> t;
cin >> s;
t.insert(s);
for (long long i = 0; i < s.length() - 1; i++) {
s = s.substr(s.length() - 1) + s.substr(0, s.length() - 1);
t.insert(s);
}
cout << t.size() << "\n";
return 0;
}
|
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
set<string> st;
for (int i = 0; i < 100; i++) {
s = s[s.size() - 1] + s;
s.pop_back();
st.insert(s);
}
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... | x=input();p={x}
for i in range(len(x)-1):
x=x[-1]+x[:len(x)-1]
p.add(x)
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>
using namespace std;
int n, m;
string s;
set<string> st;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
while (cin >> s) {
st.clear();
for (int i = 0; i < s.size(); i++) {
string s1 = "";
for (int j = 0; j < s.size(); j++) s1 += s[(i + j) % s.size()];
st.... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
public class Div2_385A {
public static void main(String[] args) throws IOException {
new Div2_385A().execute();
}
void execute() throws IOException {
BufferedReader reader = new BufferedRead... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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.math.BigInteger;
import java.util.*;
import java.io.*;
public class A{
public static void main(String arg[]) {
FastScanner sc = new FastScanner(System.in);
String x = sc.next();
ArrayList<String> list = new ArrayList<>();
int n = x.length(),c=0;
for(int i = 0;i<n;++i){
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = input()
print(len({s[i:]+s[:i] for i in range(len(s))})) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | var differentShiftsCount = function( s ) {
var shitfs,
i;
shifts = new Set();
s = s.split( "" );
for ( i = 0; i < s.length; ++i ) {
shifts.add( s.toString() );
s.unshift(s.pop());
}
return shifts.size;
};
print( differentShiftsCount ( readline() ) ); |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | ar = []
text = input()
for i in range(len(text)):
text = text[-1] + text[:-1]
if text not in ar:
ar.append(text)
print(len(ar)) |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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.*;
/**
* Created by ReaL PC on 12/6/2016.
*/
public class AAAAAA {
public static void main(String[] args) throws java.lang.Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input = reader.readLin... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | s = raw_input()
l = len(s)
m = []
temp=s
for i in range(l-1,-1,-1):
add = s[i]+temp[:(l-1)]
m.append(add)
temp = add
count = len(m)
for i in range(len(m)):
j=i+1
while(j<count):
#print i,m[i],j,m[j]
if(m[i]==m[j]):
count-=1
m.pop(j)
else:
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.*;
public class codeforces5
{
public static void main(String args[])throws IOException
{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String s=input.readLine();
String p=s;
int k=0;
int i;
do
{
s=s.charAt(s.length()-1)+s;
s=s.substring(0,s.length()-1);
k++;
}
while(s.equal... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try 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
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
import os
self.os = os
self._fd = file.fileno()
self.buffer = BytesIO()
self.writ... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | import java.io.*;
import java.util.*;
public class Solution {
public Solution() throws FileNotFoundException {
}
class Pair<F, S> implements Serializable {
F first;
S second;
public Pair(F first, S second) {
this.first = first;
this.second = second;
... |
Problem: Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word.
Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last c... | IN = input()
print(len(set([IN[-i:]+IN[:-i] for i in range(len(IN))])))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.