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... | strlen=int(input())
str=input()
def get_split_content(str,strlen,left_separator,right_separator):
"""
将左右分隔符中间及以外的内容分开
"""
in_parentheses = []
out_parentheses = []
index = 0
left_flag = 0
while(True):
if(index>=strlen):
break
if(str[index]== left_separator):... |
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() + '_'
max_out = 0
max_in = 0
count = 0
flag = False
for i in range(n + 1):
t = s[i]
if s[i] == '(':
if count > max_out:
max_out = count
count = 0
flag = True
elif s[i] == ')':
flag = False
continue
if 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 = int(input())
str = str(input())
inbrackets = False
inword=False
lengths = []
count_in_brackets=0
#max_length_out_of_brackets=0
l=0
for i in range(0,n):
if str[i]=="(":
inword=False
inbrackets=True
lengths.append(l)
l=0
continue
if str[i]==")":
inbrackets=Fals... |
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())
st = input()
i = 0
maxl = 0
numins = 0
ln = 0
while i < n:
fl = 0
if st[i] == '(':
i += 1
while st[i] != ')':
if st[i] != ('_'):
fl = 1
else:
numins += fl
fl = 0
i += 1
numins += fl
... |
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, i = 0, count1 = 0, count2 = 0, big = 0;
cin >> n;
char arr[n];
cin >> arr;
while (arr[i] != '\0') {
if ((arr[i] >= 'a' && arr[i] <= 'z') || (arr[i] >= 'A' && arr[i] <= 'Z'))
big++;
else {
big = 0;
if (arr[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... | def main():
n = input()
s = raw_input()
i = 0
Out = []
In = []
while i < n:
if s[i] == '(':
i += 1
begin = i
while s[i] != ')':
i += 1
In.append(s[begin:i])
i += 1
#print In
for 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 = int(raw_input())
text = raw_input().strip()
outside_longest = 0
inside_num = 0
outside_strs = []
inside_strs = []
i = 0
tmp = ''
while i < n:
if text[i] == '_':
tmp += '_'
elif text[i] == '(':
if tmp != '':
outside_strs.append(tmp)
tmp = ''
elif text[i] == ')':
if tmp != '':
inside_strs.appen... |
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('')
def tokenize(s_input):
s_input = s_input.replace('(', '_').replace(')', '_')
return [x for x in s_input.split('_') if x != '']
mask = []
inside_brackets = False
for i, c in enumerate(s):
if c == '(': inside_brackets = True
elif c == ')': inside_brackets = False
if insi... |
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... | trash = raw_input("")
words = raw_input("")
longestWord = 0
wordsInParen = 0
candidate = 0
inParens = False
for c in words:
if not (c in "_()"):
if inParens:
continue
candidate += 1
else:
if c == "(":
inParens = True
elif c == ")":
inParens... |
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 sys
import math
import bisect
def solve(s):
#print('s: ' + str(s))
n = len(s)
A = []
B = []
nest = False
tmp = []
for i in range(n):
if s[i] == '(':
nest = True
elif s[i] == ')':
nest = False
elif s[i].isalpha():
tmp.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... | import java.io.*;
import java.util.*;
import static java.lang.System.*;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(in));
StringTokenizer st;
int ans1 = 0;
int ans2 = 0;
br.readLine();
String line = br.readLine(... |
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;
int i, w;
char arr[n];
for (i = 0; i < n; i++) {
cin >> arr[i];
}
int wordsIn = 0, longest = 0;
bool inPa = false;
int len = 0;
int lenb = 0;
int realLongest = 0;
for (i = 0; i < n; i++) {
if (len == 1) {
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... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const long long LNF = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e2 + 5;
const long long mod = 10000000000007... |
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.PrintStream;
import java.util.Scanner;
/**
*/
public class MainB {
public static void main(String[] args) {
run(System.in, System.out);
}
public static void run(InputStream in, PrintStream out) {
try (Scanner sc = new Scanner(in)) {
int n = sc.nextInt();
sc.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... | n = int(raw_input())
s = raw_input()
count_para = 0
max_len = 0
currLen = 0
i = 0
while(i<n):
if(s[i]=='('):
i+=1
if(s[i]!=')'):
while(i<n and s[i]!=')'):
if(s[i]=='_'):
i+=1
else:
while(i<n and s[i]!='_' and s[i]!=')'):
i+=1
count_para+=1
i+=1
else:
i+=1
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... | def main():
s = raw_input()
s = ')'+raw_input()
segments = map(lambda x: x.split(')'), s.split('('))
insegs = map(lambda x: x[0], segments)
outsegs = map(lambda x: x[1], segments)
# count words in parentheses
numwords = reduce(lambda x, y: x+y, map(lambda x: len(filter(lambda y: len(y)>0, x.split('_'))), insegs... |
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() + '_'
a, b = 0, 0
l, f = 0, False
for c in s:
if c == '(':
a = max(a, l)
l, f = 0, True
elif c == ')':
b += 1 if l > 0 else 0
l, f = 0, False
elif c == '_':
if f:
b += 1 if l > 0 else 0
else:
a = max(a, l)
... |
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... | // Main Code at the Bottom
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
//Fast IO class
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
boolean env=System.getProperty("ONLINE_JUD... |
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... | # python3
# utf-8
import itertools
def string___ins__outs(string):
string = string
# '(___)'
splted_by_op = string.split('(')
# print(splted_by_op)
# ['', '___)']
ins = [x.split(')')[0] for x in splted_by_op if ')' in x]
# ['___']
# ['', '___)']
outs = [x.split(')')[-1] for x in sp... |
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;
void solve() {
int n;
cin >> n;
;
string s;
cin >> s;
;
vector<string> Inside;
vector<string> Outside;
string w = "";
int z = 1;
for (int i = 0; i < n; i++) {
if (s[i] != '_' && s[i] != '(' && s[i] != ')') w.push_back(s[i]);
if (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
input()
v=re.split('[()]',raw_input())
print max(max(map(len,s.split('_'))) for s in v[::2]),sum(len(filter(None,s.split('_'))) for s in v[1::2]) |
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 sys
import re
input_length = sys.stdin.readline()
input = sys.stdin.readline().rstrip()
inside_parentheses = []
outside_parentheses = []
opening_parentheses = [m.start() for m in re.finditer("\(", input)]
closing_parentheses = [m.start() for m in re.finditer("\)", input)]
# print opening_parentheses
# print ... |
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
data = stdin.readlines()
n = int(data[0].strip())
s = data[1].strip()
insk = False
massin = []
massout = []
word = ''
for ch in s:
if ch=='(':
if word:
massout.append(word)
word = ''
insk = True
elif ch==')':
if word:
massin.app... |
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 = input() + '_'
inbrackets = False
l = 0
c = 0
length = len(s)
cur = 0
for i in range(length):
if s[i] == '_':
if not inbrackets:
l = max(l, cur)
else:
if cur > 0:
c += 1
cur = 0
elif s[i] == '(':
if not inbrackets:
... |
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 Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int n = in.nextInt();
String text = in.next();
ArrayList<String> Inside = ... |
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
from collections import deque
from collections import Counter
def ir():
return int(raw_input())
n = ir()
s = raw_input()
def pw(i, j):
global m, nw
if b:
nw += 1
else:
c = j - i
if c > m: m = c
i = 0; b = False; nw = 0; m = 0
while True:
if i == n: brea... |
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... | raw_input()
s0 = raw_input().split('(')
s = []
A, B = 0, 0
for x in s0:
s += x.split(')')
for i in range(len(s)):
if i % 2 == 1:
for x in s[i].split('_'):
B += len(x) != 0
else:
for x in s[i].split('_'):
A = max(A, len(x))
print A, 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... | """
Oh, Grantors of Dark Disgrace,
Do Not Wake Me Again.
"""
ii = lambda: int(input())
si = lambda: input()
n = ii()
s = si().split('(')
o = s[0].split('_')
i = []
for j in s[1:]:
a, b = j.split(')')
i += a.split('_')
o += b.split('_')
print(len(max(o, key=len)), len(list(filter(None, 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 = int(input())
raw_text = input()
max_len = 0
tmp_len = 0
num_word_in_brace = 0
insideFlag = False
withinWord = False
symbol = '()_'
for i in range(n):
if raw_text[i] == '(':
insideFlag = True
elif raw_text[i] == ')':
insideFlag = False
if insideFlag:
if raw_text[i-1] in symbol 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... | import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
public class Strings {
public static int[] getArray(int size) {
int[] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = sr.nextInt();
}
return array;
}
public static int[][] getMatr... |
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 python
# coding: utf-8
# Тип: implementation=реализация
if __name__ == '__main__':
import sys
f = sys.stdin
#f = open('/home/ilya/opt/programming/tasks/723B.txt')
n = int(f.readline())
line = f.readline()[:n]
#print line
class stat:
max_out = 0
in_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())
s = input()
k = 0
m = 0
f = 0
t = 0
for i in range(n):
if s[i] == '(':
if k != 0 :
m = max(m,k)
f = 1
if s[i] == ')':
if k != 0:
t = t+1
f = 0
if s[i] == '_' or s[i] == '(' or s[i] == ')':
if f == 0 and s[i] != ')':
m = max(m,k)
if f == 1 and k != 0 and s[i] != '(':
t = t+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 l, n, m, mi = 100000, f, in, cnt, ma, j;
string s;
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> s;
for (int i = 0; i < n; i++) {
j = i;
while ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) i++;
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... | import re
x = int(raw_input())
s = raw_input()
inside = re.findall(r'\([a-z,A-Z,_]+\)', s)
if len(inside) == 0:
count = 0
else:
count = 0
for i in inside:
count += len(re.findall(r'[a-z,A-Z]+', i))
s = s.replace(i, '_')
sl_vne_skobok = re.findall(r'[a-z,A-Z]+', s)
if len(sl_vne_skobok) ... |
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=list(input())
i=0
s.append('_')
lengm=0
c=0
while i<n+1:
leng=0
if 'A'<=s[i]<='Z' or 'a'<=s[i]<='z':
while 'A'<=s[i]<='Z' or 'a'<=s[i]<='z':
leng+=1
i+=1
lengm=max(lengm,leng)
if s[i]=='(':
while s[i]!=')':
if 'A'<=s[i]<='Z' or '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... | t=input()
l=raw_input().replace(')',')(').split('(')
while '' in l:
l.remove('')
ans=0
ans2=0
for x in l:
if x[-1]==')':
temp=x[0:-1]
k=temp.split('_')
while '' in k:
k.remove('')
ans=ans+len(k)
else:
k=x.split('_')
while '' in k:
k.rem... |
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.*;
public class Solution {
private static final String OPEN = "(";
private static final String CLOSED = ")";
private static int getLength(String s) {
int l = 0;
for (String w : s.split("_")) {
l = Math.max(l, w.length());
}
return l;
}
private static int count(String s) {
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()
def f1(last,i):
global s
m=0
for k in s[last:i].split('_'):
m=max(len(k),m)
return m
def f2(last,i):
global s
m=0
for k in s[last:i].split('_'):
if k!='': m+=1
return m
a1=0
a2=0
last=0
i=0
while i<n:
if s[i]=='(':
a1=max(f1(last,i),a1... |
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.*;
public class cfs375B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
sc.nextInt();
char[] chars = sc.next().toLowerCase().toCharArray();
int outsidecurr = 0;
int inside = 0;
int outside = 0;
int cur = 0;
String alpha = "abcdefghijklmnopqrstuvwxyz";
... |
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()
s=s+"_"
ip=0
m=0
flag=0
a=""
for i in s:
if i=="(":
m=max(m,len(a))
flag=1
a=""
elif i.isalpha():
a+=i
elif i=="_" and a!="" and flag==1:
ip+=1
a=""
elif i=="_" and a!="" and flag==0:
m=max(m,len(a))
a=""
elif 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 = int(input())
maxout = 0
numin = 0
currout = 0
currin = False
out = True
for char in input():
if char in ['_','(',')']:
if out and maxout < currout:
maxout = currout
currout = 0
if (not out) and currin:
currin = False
numin += 1
if char in ['(',... |
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__":
N = int(input())
text = input()
outside = True
res1 = 0
res2 = []
word = ""
for c in text:
if (outside):
if (c == '_'):
res1 = max(res1, len(word))
word = ""
elif (c == '('):
outside ... |
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>
int main() {
int n;
std::cin >> n;
bool ip = false;
char p;
std::cin >> p;
char c;
int cwc = 0;
int wip = 0;
int m = 0;
if (p == '(')
ip = true;
else if (p != '_') {
cwc++;
m = 1;
}
for (int i = 1; i < n; i++) {
std::cin >> c;
if (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... | #include <bits/stdc++.h>
using namespace std;
string s;
int L, N;
int main() {
int a, koks = 0;
cin >> a >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '_' or s[i] == '(') {
if (koks != 0) L = max(L, koks);
koks = 0;
} else
koks++;
if (s[i] == '(') {
i++;
int lel ... |
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.LinkedList;
import java.util.Scanner;
public class Main
{
private static boolean check(char ch)
{
if (ch >= 'a' && ch <= 'z')
return true;
else if (ch >= 'A' && ch <= 'Z')
return true;
else
return false;
}
private static LinkedList<Integer> stack = new LinkedList<Integer>();
pu... |
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 sys
def find(s, ch):
return [i for i, ltr in enumerate(s) if ltr == ch]
a=int(input())
stringlist=raw_input()
#print a
#print stringlist
left=find(stringlist,'(')
right=find(stringlist,')')
if len(left)==0:
outparent=stringlist.split("_")
if '' in outparent:
#outparent=outparent.remove('')
... |
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(raw_input())
s = raw_input().strip().replace("_", " ").replace("(", " (").replace(")", ") ").split()
cs = 0 #outside
ml = 0
nw = 0
for word in s:
if word.startswith("("):
cs = 1
if cs:
if word not in("(", ")", "()"):
nw += 1
else:
ml = max(ml, len(word))
if wo... |
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(raw_input())
y=raw_input()
add=count=c=0
f=False
for i in y:
if i=='_':
if f:
if c>0:
count+=1
else:
add=max(add,c)
c=0
elif i=='(':
add=max(add,c)
c=0
f=True
elif i==')':
if c>0:
count+=1
c=0
f=False
else:
c+=1
add=max(add,c)
print add,count |
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, first = -1, mxlen = 0, cnt = 0;
bool exp = false;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; i++) {
if (s.at(i) == '_') {
if (exp) {
if (i - first - 1 > 0) cnt++;
} else
mxlen = max(mxlen, i - first -... |
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=list(input())
kil,ma=0,0
dl=0
d=0
for i in range(n):
if s[i]=='(': dl=0; d+=1
elif s[i]==')':
if dl: kil+=1
d-=1
dl=0
elif d==1:
if s[i]=='_':
if dl: dl=0; kil+=1
else: dl+=1
elif d==0:
if s[i]=='_': dl=0
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>
int main() {
char in[265];
int n;
scanf("%d %s", &n, in);
int ma = 0, c = 0;
bool inp = 0;
int cc = 0, c_ = 0;
char bef = '\0';
for (int i = 0; i <= n; i++) {
if (!inp) {
if (in[i] == '_' || in[i] == '(' || in[i] == '\0') {
if (cc > ma) ma = cc;
cc = 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... | i = int(input())
l = list(input())
longstnotinpar = 0
wordcount = 0
inparcount = 0
p = 0
for x in l:
if x == '(':
p = 1
if wordcount > longstnotinpar: longstnotinpar = wordcount
wordcount = 0
elif x == ')':
p =0
if wordcount > 0: inparcount += 1; wordcount = 0
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... | #include <bits/stdc++.h>
const int maxn = 1025;
const int maxm = 10;
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
int ans1 = 0, ans2 = 0;
int cnt1 = 0;
int f = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '(') {
f = 1;
ans1 = max(ans1, cnt1);
cnt1... |
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()
x = raw_input()
num = 0
ans1, ans2 = 0, 0
maxy, i = 0, 0
while i < n:
p = i
ans1 = 0
if x[p] == '(':
while x[p]!=')':
p+=1
if p+1 != n:
p+=1
else: break
while x[p]!='(':
if x[p] == '_':
ans1 = 0
else:
ans1+=1
p+=1
if ans1 > maxy: maxy = ans1
if p == n:break
i = p
i, c = 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 java.util.*;
public class sevenB
{
public static void main(String ...args)
{
int n,i,j,k,l;
Scanner sc=new Scanner (System.in);
n=sc.nextInt();
String str;
str=sc.next();
char ch='1';
int maxi=0,maxi2=0,count1=0;
i=0;
while (i<n)
{
if (st... |
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... | k = raw_input()
s = raw_input()
s = s.replace('(','_(_')
s = s.replace(')','_)_')
s = s.replace('_',' ')
#print s
lis = s.split()
sta = False
n1 = 0
n2 = 0
#print lis
for one in lis:
if one[0] != '(' and one[0] != ')':
if sta == False:
n1 = max(n1, len(one))
else:
n2+=1
elif one[0] == '(':
sta = True
els... |
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.io.PrintWriter;
public class Secure {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.value... |
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 long long mod = 998244353;
int CASE = 1;
const int mxn = 1e3 + 1;
const long long INF = 1e18;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
int cntwordinquotes = 0;
int cntq = 0, cnt = 0, max_length = 0;
bool ok = true;
for (char c : s) {
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... | import java.util.Scanner;
public class ThedocumentAnalysis {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int n = input.nextInt();
String s = input.next();
int len = 0;
boolean condition = false;
int wo... |
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
flag_left = False
max_ = 0
cant = 0
cant_words = 0
n = input()
cad = input()
groups = re.findall(r"\(.*?\)", cad)
for g in groups:
cant_words += len(re.findall(r"[a-zA-Z]+", g))
for c in cad:
if c.isalpha() and not flag_left:
cant += 1
else:
if not c.isalpha():
... |
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().replace('(', '-').replace(')', '-').split('-')
print(len(max('_'.join(s[::2]).split('_'), key = len)),
sum(len(word) > 0 for word in '_'.join(s[1::2]).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;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, mx = 0, ans2 = 0, ch = 0, c = 0, cnt = 0;
cin >> n;
string s;
cin >> s;
for (long long i = 0; i < n; i++) {
if (s[i] == '(') {
c = 1;
mx = max(mx, cnt);
cnt = 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 java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.regex.*;
//Arrays.stream(br.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray();
public class solution{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pw = new Prin... |
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()
if "(" not in s:
l=0
s2=s.split("_")
for i in s2:
if(len(i)>l):
l=len(i)
print(l,end=" ")
print(0)
else:
o=[]
c=[]
for i in range(n):
if(s[i]=="("):
o.append(i)
elif(s[i]==")"):
c.append(i)
b=0
f... |
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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class _0950TextDocumentAnalysis {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
sc.nextLine();
String str=sc.nextLine();
boolean cal=false;
L... |
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__":
input()
s = input()
max_len_outside = 0
inside_count = 0
inside_braces = False
current_len = 0
for i in range(len(s)):
if s[i] == '_':
if not inside_braces:
max_len_outside = max(max_len_outside, current_len)
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... | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class b723 implements Runnable{
public static void main(String[] args) {
try{
new Thread(null, new b723(), "process", 1<<26).start();
}
catch(Exception 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 n, x, y;
char str[310];
int main() {
scanf("%d%s", &n, str);
int cur = 0, bracket = 0;
for (int i = 0; str[i]; ++i) {
if (str[i] == '(') {
++bracket;
x = max(x, cur);
cur = 0;
} else if (str[i] == ')') {
--bracket;
if (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... | //package D375_2;
import java.util.Scanner;
public class B {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
String s = scan.next();
int countWord = 0;
int maxLen = 0;
boolean open = false;
boolean startC... |
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 x1, x2, x3;
int n;
char str[255 + 5];
bool in_seque = false;
bool is_underline = true;
int ans1, ans2;
int cnt1, cnt2;
int main() {
scanf("%d", &n);
scanf("%s", str + 1);
for (int i = 1; i <= n; ++i) {
if (str[i] == '(') {
in_seque = true;
ans1 = 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... | import re
_ = raw_input()
s = raw_input()
in_cnt = 0
for t in [p.split(')')[0] for p in s.split('(') if ')' in p]:
for u in t.split('_'):
in_cnt += 1 if len(u) else 0
out_cnt = 0
for t in re.sub(r'\([^)]*\)', '_', s).split('_'):
out_cnt = max(out_cnt, len(t))
print out_cnt, in_cnt |
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 maxn = 1000;
char a[maxn];
int n;
int main() {
scanf("%d", &n);
scanf("%s", a);
int maxlen = 0;
int f = 0;
bool f1 = false;
int tot = 0;
int tlen = 0;
for (int i = 0; i < n; i++) {
if (!f) {
if (isalpha(a[i])) {
tlen++;
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... | str = raw_input()
str = raw_input() + '_'
cur = 0
mx = 0
cnt = 0
par = False
for c in str:
if c.isalpha() and not par:
cur += 1
else:
mx = max(mx, cur)
cur = 0
if c == '(':
par = True
elif c == ')':
par = False
for i in range(len(str)):
if(str[i] == '('):
fnd = False
for j in range(i, len(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... | import java.util.Scanner;
public class B {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str = sc.next();
int fl=0;
int max =0;
int curr=0;
int word=0;
int count=0;
for(int i=0;i<n;i++){
if(fl==0){
if(str.charAt(i)=='_'){
if(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... | #include <bits/stdc++.h>
using namespace std;
int n, x = 0, y = 0;
string a;
void f(int i, bool p) {
if (i >= n) return;
if (p == 0) {
while (a[i] == '_' && i < n) i++;
if (a[i] == '(' && i < n) {
f(i + 1, 1);
return;
}
int z = 0;
while (a[i] != '_' && (a[i] != '(' && i < 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... | def fn1(s):
ans=0
s="_"+s+"_"
#print(s)
un=[]
for i in range(len(s)):
if s[i]=="_":
un.append(i)
for i in range(len(un)-1):
if un[i+1]-un[i]>1:
ans+=1
return ans
def fn2(s):
ans=-1
s="_"+s+"_"
un=[]
for i in range(len(s)):
if 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... | n = int(input())
text = input()
op = 0
word = ""
ans, tot = 0, 0
for l in text:
if len(word) and op == 0:
ans = max(ans, len(word))
if l == '(':
if len(word) > 0 and op > 0:
tot += 1
op += 1
word = ""
elif l == ')':
op -= 1
if len(word) > 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... | _,s = input(),input()
ins = False
c=im=om=0
for l in s:
if l == '(':
om=max(om,c)
c=0
ins=True
elif l==')':
ins=False
if c:
im+=1
c=0
elif l=='_':
if not ins: om=max(om,c)
elif c: im+=1
c=0
else:c+=1
om=max(om,c)
print(om,im) |
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 solve():
raw_input()
string = raw_input()
string += '_'
numpar = 0
numnopar = 0
insidepar = False
size = 0
for i in xrange(len(string)):
if string[i].isalpha():
size+=1
else:
if not insidepar:
numpar = max(numpar, size)
else:
if size > 0:
numnopar += 1
size = 0
if string[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 = int(input())
s = input()
longest_out = 0
words_inside = 0
is_inside = False
word_len = 0
for i in range(len(s)):
if s[i] == '(':
longest_out = max(longest_out, word_len)
word_len = 0
is_inside = True
elif s[i] == ')':
if word_len > 0:
word_len = 0
words_inside += 1
is_inside = False
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... | /**
* Created by My PC on 03/10/2016.
*/
import java.util.*;
public class P2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int length = input.nextInt();
input.nextLine();
String str = input.nextLine();
int maxLength = 0;
int 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()
sesgsin = []
toksout = []
inparens = []
outparens = []
for i,c in enumerate(s):
if c == '(':
inparens.append(i)
elif c == ')':
outparens.append(i)
numinparen = 0
for i,o in zip(inparens, outparens):
numinparen += sum(1 for t in s[i+1:o].split('_') if t)
sta... |
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.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.Input... |
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()
br = False
br_index = -1
words = 0
words_in = 0
for i in range(n):
if s[i] == '_':
if i - br_index > 1:
if not br:
words = max(words, i - br_index - 1)
elif br:
words_in += 1
br_index = i
if 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.InputStreamReader;
import java.util.LinkedList;
public class codeforces1 {
public static void main(String[] args) throws IOException {
BufferedReader linea=new BufferedReader (new InputStreamReader (System.in));
int total=Integer.pa... |
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,b, c = map(int, raw_input().split())
#
#
# print min([sum([abs(a-x) + abs(b-x) + abs(c-x)]) for x in xrange(500)])
r = raw_input()
i = raw_input()
a = re.findall('(\([a-zA-z]{1,}\))', i)
word = []
for x in a:
word.extend(x.replace('(','').replace(')','').split('_'))
un_word = [x for x in word 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 = int(raw_input())
s = raw_input()
len = 0
ml = -1
sc = 0
cnt = 0
for i in range(0, n):
if(s[i] == '_'):
if(sc == 0):
ml = max(ml, len)
elif(sc == 1 and len > 0):
cnt += 1
len = 0
elif(s[i] == '('):
if(sc == 0):
ml = max(ml, len)
elif(sc == 1 and len > 0):
cnt += 1
len = 0
sc = 1
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 re
n=input()
a=raw_input()
a=a.strip()
l=list(filter(None,re.split(r"(_|[()])",a)))
#l=list(filter(None, re.split(r"(plus|[()])", s)))
flag=0
ans1=0
ans2=0
for s in l:
if s=='(':
flag=1
elif s==')':
flag=0
elif s=='_':
continue
else:
if flag==0: #outside paran... |
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
n = int(raw_input())
s = raw_input()
par = re.split('\(|\)', s)
inpar = re.split('_', '_'.join(par[1::2]))
outpar = re.split('_', '_'.join(par[0::2]))
outpar = max(map(len, outpar))
# inpar = set(inpar) - {''}
print outpar, len([x for x in inpar if 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... | import re
n = input()
str = raw_input();
str = str.replace( "_", " " )
l = re.findall( r"[\w']+", str )
x = re.findall( '\((.*?)\)', str )
y = []
for i in x:
z = i.split()
for j in z:
y.append( j )
x = [ item for item in l if item not in y ]
ans1 = 0
try:
ans1 = max( ans1, len( max ( x, key = le... |
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 s;
int countp = 0;
void par(int st, int e) {
int x = st;
while (s[st] != '_' && st <= e) {
st++;
}
if (st != x) countp++;
for (int i = st + 1; i <= e; i++) {
if (i == e && s[i] != '_') {
countp++;
}
if (s[i] == '_') {
if (i - st ... |
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;
inline bool equal(double _x, double _y) {
return _x > _y - 1e-9 && _x < _y + 1e-9;
}
char s[300];
int mx, cnt, sum, ans;
bool OK(char c) {
if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') return 1;
return 0;
}
int main() {
int n;
scanf("%d", &n);
scanf("%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... | input()
a = input().replace('(', ')').split(')')
print(max(len(w) for s in a[::2] for w in s.split('_')), len([w for s in a[1::2] for w in s.split('_') if(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... | import re
n=int(input())
s=raw_input()
within_paren=re.findall(r'\(.*?\)',s)
for w in within_paren :
s=s.replace(w,"_")
within_paren_words=[]
for w in within_paren:
within_paren_words.extend(w[1:-1].split("_"))
s_words=s.split("_")
leng=0
for w in s_words :
if len(w) > leng :
#longest=w
leng=len(w)
cnt=0
for 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... | import re
def read(t=None):
string = raw_input()
return string if t is None else [t(x) for x in string.split()]
def solve(s):
a, b = '_', '_'
out = True
for x in s:
if x == '(':
out = False
a += '_'
b += '_'
continue
if x == ')':
out = True
a += '_'
b += '_'
continue
if out:
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... | //package com.codeforces.competitions.year2016.round375div2;
import java.io.*;
import java.util.*;
public final class TaskB
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
Solver solver = new Solver(in, ... |
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__':
n = int(input())
s = input().replace('(', "_(_").replace(')', "_)_")
l = 0
in_bracket = False
count = 0
for w in s.split('_'):
if w == "":
continue
if w == "(":
in_bracket = True
continue
if w == ")":
in_bracket = False
continue
if in_bracket:
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... | n = int(raw_input().strip())
s = raw_input().strip()
s1 = ""
s2 = ""
i = 0
n = len(s)
while i < n:
while i < n and s[i] <> '(':
s1 += s[i]
i += 1
s1 += "_"
i += 1
while i < n and s[i] <> ")":
s2 += s[i]
i += 1
s2 += "_"
i += 1
x1 = s1.split("_")
x2 = s2.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;
char s[300];
int n, t, len, num, in;
int main() {
scanf("%d%s", &n, s + 1);
while (t < n) {
if (s[t] == '(')
in = 1;
else if (s[t] == ')')
in = 0;
int i = t + 1;
while (i <= n && s[i] != '(' && s[i] != ')' && s[i] != '_') i++;
if (i > t +... |
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;
ifstream fin("input.txt");
int main() {
int n, i;
cin >> n;
string s;
cin >> s;
int ans1 = 0, ans2 = 0, cur = 0;
bool inside = false;
for (i = 0; i < n; i++) {
if (s[i] == '(') {
inside = true;
ans1 = max(ans1, cur);
cur = 0;
} else i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.