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... | n = int(input())
s = input()
a, b = 0, 0
while s.find('(') != -1:
l, r = s.find('('), s.find(')')
m = max(len(i) for i in s[:l].split('_'))
a = max(a, m)
b += sum(1 for t in s[l+1:r].split('_') if t != '')
s = s[r+1:]
m = max(len(i) for i in s.split('_'))
a = max(a, m)
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... | banyak = int(input(''))
str = input('')
str = str.replace('(','_(_')
str = str.replace(')','_)_')
str2 = str.split('_')
dalam = False
max1 = 0
max2 = 0
for i in str2 :
if i != '':
#print(i)
if i == '(' :
dalam = True
elif i == ')' :
dalam = False
elif not(dalam):
if max1 < len(i) : max1 = len(i)
eli... |
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.*;
public class apples{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String s=sc.next();
int max_len=0,len=0,words=0;
boolean p=false;
for(int i=0;i<n;i++){
if(p==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 re
n = raw_input()
s = raw_input()
def to_word(string):
return re.findall(r'[A-Za-z]+', string)
match = re.compile(r'\([^)]*\)')
inside = match.findall(s)
outside = match.sub('_', s)
if not inside: inside = [' ']
if not outside: outside = ' '
inside = ''.join(inside)
inside = to_word(inside)
outside = to_... |
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... | length= int(raw_input())
string= raw_input("")
current = ")"
mx=0
comp=0
for i in string:
if i == "(" or i == ")":
current = i
if current == ")":
if i.isalpha():
comp= comp + 1
if comp> mx:
mx= comp
if i=="_" or i=="(" or 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... | input()
s = input()
outer = []
inner = []
in_bra = False
for c in s:
if c in ('(', ')'):
inner.append('_')
outer.append('_')
in_bra = c == '('
else:
a, b = (inner, outer) if in_bra else (outer, inner)
a.append(c)
b.append('_')
outer = sorted(''.join(outer).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... | # Online Python compiler (interpreter) to run Python online.
# Write Python 3 code in this online editor and run it.
charLength = int(input())
string = input()
out_dict = {
'longest_length': 0,
'n_par_words': 0,
'word_length': 0,
'par': False
}
for i, char in enumerate(string):
if char != '_' 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... | cnt = lambda s, x: s.count(x)
ii = lambda: int(input())
si = lambda: input()
f = lambda: map(int, input().split())
il = lambda: list(map(int, input().split()))
dgl = lambda: list(map(int,input()))
n=ii()
s=si()
w=0
lt=0
mxw=0
lt1=0
i=0
while i<n:
if s[i]=='(':
mxw=(max(mxw,lt1))
lt1=0
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
int n, a = 0, b = 0, f = 0;
cin >> n >> s;
for (int i = 0; i <= n; i++)
if (s[i] == '_' || s[i] == '(' || s[i] == ')' || i == n) {
if (!f)
a = max(a, (int)t.length());
else if (t != "")
b++;
if (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... | from sys import stdin as fin
# fin = open("cfr375b.in")
n = int(fin.readline())
# n, m = map(int, fin.readline().split())
# line = tuple(fin.readline().strip())
line = fin.readline()
delim = ('(', ')', '_', '\n')
par = 0
cnt = cntin = maxout = 0
for sym in line:
if sym not in delim:
cnt += 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(input())
s = input() + '_'
parentheses = 0
par_arr = []
max_length = 0
in_vocab = 0
words = []
j = 0
for i, k in enumerate(s):
if k == '_':
words.append(s[j:i])
j = i + 1
par_arr.append(parentheses)
continue
elif k == '(':
words.append(s[j:i])
j = 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.io.PrintWriter;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
/**
* Created by Anna on 03.10.2016.
*/
public class TaskB {
StringTokenizer st;
BufferedReader 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... |
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String data;
scanner.next();
data = scanner.next();
String data2 = "";
char 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... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, inside = 0, outside = 0, p = 0, cnt = 0, cnt1 = 0;
scanf("%d", &n);
char s[255];
scanf("%s", s);
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
p = 1;
if (cnt) {
outside = max(outside, 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... | #include <bits/stdc++.h>
using namespace std;
const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;
int n, m;
char s[MAXN];
void read() {
scanf("%d", &n);
scanf("%s", &s);
}
void solve() {
s[n] = '_';
n++;
int p = 0, q = 0, now = 0, lv = 0;
for (int i = 0; i < n; 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... | N = int(input())
S = input()
L = S.split("(")
insides = []
outsides = []
for l in L:
if ")" in l:
ind = l.index(")")
insides.append(l[:ind])
if ind != len(l) - 1:
outsides.append(l[ind+1:])
else:
outsides.append(l)
insides_ = []
outsides_ = []
for l in insides:
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... | #include <bits/stdc++.h>
using namespace std;
string espacios(string s) {
for (int k = 0; k < s.length(); k++) {
if (s.at(k) == '_') s.at(k) = ' ';
}
return s;
}
string parentesis(string s) {
for (int k = 0; k < s.length(); k++) {
if (s.at(k) == '(' || s.at(k) == ')') s.at(k) = ' ';
}
return s;
}
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... | n=int(input())
s=input().strip()
lw=0
lw1=0
cw=0
bf=0
wf=0
for i in s:
if i=='(':
if lw1>lw:
lw=lw1
lw1=0
bf=1
wf=0
elif i==')':
lw1=0
if wf and bf:
cw+=1
bf=0
wf=0
elif i=='_':
if lw1>lw:
lw=lw1
lw1=0
if wf and bf:
cw+=1
wf=0
else:
if not bf:
lw1+=1
wf=1
if lw1>lw:
lw=lw... |
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.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
InputStream 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;
string s;
cin >> n;
cin >> s;
bool inside = 0;
int a = 0, b = 0, len = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
len = 0;
inside = 1;
continue;
}
if (s[i] == ')') {
if (len) {
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... | #include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1};
int main() {
int n, i = 0;
char a[500];
cin >> n;
cin >> a;
int c1 = 0, c2 = 0;
for (int i = 0; i < (n); i++) {
if (a[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 = int(raw_input())
s = raw_input().lower()
sects = re.split("\(|\)", s)
words = [0]
paren_w_q = 0
for i in xrange(len(sects)):
if len(sects[i]) > 0:
if i % 2 == 0:
s_words = re.split("_+", sects[i])
s_words = filter(lambda e: True if len(e) > 0 else False, s_words)
words += map(len, s_words)
... |
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 = 1e5 + 5;
vector<double> v;
bool prime[N + 1];
void pre() {
memset(prime, true, sizeof(prime));
prime[0] = prime[1] = 0;
for (int p = 2; p * p <= N; p++) {
if (prime[p] == true) {
for (int i = p * 2; i <= N; i += p) prime[i] = 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... | n = int(input())
#n, m = map(int, input().split())
s = input()
#c = list(map(int, input().split()))
k = 0
l = 0
p = 0
x = 0
for i in range(n):
if p == 0:
if s[i] == '(':
p = 2
k = max(x, k)
x = 0
y = 0
elif s[i] == '_':
p = 1
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;
int main() {
string s, str;
long long n;
cin >> n;
getchar();
vector<string> v;
cin >> s;
long long p = s.size();
for (int i = 0; i < p; i++) {
if (s[i] == '_')
str += ' ';
else if (s[i] == '(') {
str += ' ';
str += s[i];
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;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Problem_723B {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
input.nextInt();
String s = input.next();
Matcher m = Pattern.compile("\\(([^)]*)\\... |
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 += '_'
skob = 0
cnt = 0
maxL = 0
word = ''
for i in range(len(s)):
cur = s[i]
if cur == '_':
if skob > 0 and len(word) != 0:
cnt += 1
else:
if len(word) != 0:
if len(word) > maxL:
maxL = len(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... | # your code goes here
x = input()
s = raw_input()
w = []
p=[]
b = s.split('(')
w.append(b[0])
for i in b[1:]:
t = i.split(')')
p.append(t[0])
w.append(t[1])
pp=[]
ww=[]
for i in p:
pp += i.split('_')
for i in w:
ww += i.split('_')
ppp = []
www = []
for i in pp:
if(i):
ppp.append(i)
for i in ww:
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 = int(input())
s = input()
s = s.replace('(', '_(_')
s = s.replace(')', '_)_')
word = s.split('_')
cntI = 0
mx = 0
inside = False
for w in word:
if w == '':
continue
# print(w)
if w == '(':
inside = True
continue
if w == ')':
inside = False
continue
if 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.util.Scanner;
public class CodeForces
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
scan.next();
char[] s = scan.next().toCharArray();
boolean in = false;
int len = 0, maxLen = 0, words = 0;
for (int i = 0; i < s.length; i++)
{
if ('a' <= s[i] && 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() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
string s;
cin >> n >> s;
s.push_back('_');
int max_char = 0, char_cnt = 0, word_cnt = 0;
bool b = false;
for (int i = 0; i <= n; i++) {
char c = s[i];
if (c == '(') {
max_ch... |
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.text.DecimalFormat;
public class B {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
String s = scan.next();
char[] c = s.toCharArray();
int a = 0,b = 0;
int k = 0;
bool... |
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())
out,ins = 0,0
s = input()
p = 0
w = 0
for i in s:
if p==0:
if i=='(':
p=1
out = max(out,w)
w = 0
elif i=='_':
out = max(out,w)
w = 0
else:
w+=1
else:
if i==')':
p = 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... | #include <bits/stdc++.h>
using namespace std;
char s[300];
int main() {
int n;
scanf("%d", &n);
scanf("%s", s);
int ca = -1, cb = 0;
int cl = 0, inb = 0;
for (int i = 0;; i++) {
if (isalpha(s[i])) {
cl++;
} else {
if (!inb) ca = max(cl, ca);
if (cl) cb += inb;
cl = 0;
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, max_out_len = 0, in_num = 0, temp = 0;
char a;
bool is_in = false, pre_eng = false;
while (scanf("%d", &n) != EOF) {
getchar();
max_out_len = 0, in_num = 0, temp = 0;
is_in = false, pre_eng = false;
for (int i = 0; i < n; 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 n;
const int maxn = 300;
char s[maxn];
int main(int argc, const char* argv[]) {
cin >> n;
scanf("%s", s);
int cnt = 0;
int len = strlen(s);
s[len++] = '_';
int l1 = 0;
int ans1 = 0;
int ans2 = 0;
bool flag = false;
for (int i = 0; i < len; 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()
st = raw_input()
st += "_"
mxcnt, cnt = 0, 0
is_open = False
word = ""
for l in st:
if l == '_':
if is_open and word != "":
cnt += 1
word = ""
else:
mxcnt = max(len(word), mxcnt)
word = ""
elif l == '(':
is_open = True
mxcnt = max(len(word), mxcnt)
word = ""
elif l == ')':
is_open... |
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, inside = 0, outside = 0, parenthesis = 0;
char c[260];
scanf("%d", &n);
scanf("%s", c);
for (int i = 0; i < n; i++) {
if (isalpha(c[i])) {
int cnt = 0;
while (i < n && isalpha(c[i])) i++, cnt++;
i--;
if (parenthesis ... |
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()
count,c2,flag=0,0,0
l,p=[],[]
for i in range(len(s)):
if s[i]=='_' and flag!=1:
if count!=0:
l.append(count)
count=0
elif s[i]=='(' or flag==1:
flag=1
if count!=0:
l.append(count)
count=0
if s[i]!=')':
if s[i]!='_' and s[i]!='(':
c2+=1
elif s[i]=='_':
if c2!... |
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=raw_input()
ans1,ans2=0,0
inflag=False
currsize=0
for x in a:
if x=='_':
if inflag:
ans2 += (currsize>0)
else:
ans1 = max(ans1,currsize)
currsize = 0
elif x == '(':
ans1 = max(currsize, ans1)
currsize = 0
inflag = True
elif 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... | #include <bits/stdc++.h>
int l, m, c, i, p, t;
char s[1000];
int main() {
scanf("%d%s", &l, s);
for (i = 0; i < l; i++) {
if (s[i] == '_') {
if (p && t) c++;
if (!p && t > m) m = t;
t = 0;
} else if (s[i] == '(') {
p = 1;
if (t > m) m = t;
t = 0;
} else 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())
s = input()
b = 0
d = 0
max_d = 0
m = False
k = 0
for i in range(n):
if s[i] == '(':
b += 1
elif s[i] == ')':
b -= 1
if b == 0:
if s[i] == '_' or s[i] == ')' or s[i] == '(':
if d > max_d:
max_d = d
d = 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... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.ut... |
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()
cur = ''
lis = []
lis1 = []
brack = 0
for i in xrange(n):
if s[i] == '(':
lis1.append(cur)
cur = ''
brack = 1
continue
elif s[i] == ')':
lis.append(cur)
brack = 0
cur = ''
continue
elif brack:
if (s[i] >= 'a' and s[i] <='z') or (s[i] >= 'A' and s[i] <= 'Z'):
cur += 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... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... |
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 bisect
#input=sys.stdin.readline
#t=int(input())
def takeSecond(elem):
return elem[1]
def gcd(a,b):
if (b == 0):
return a
return gcd(b, a%b)
def solve(i1,j1):
cnt3=0
y=ord(s[i1])
if (y>=65 and y<=90) or ( y>=97 and y<=122):
cnt3=1
for i2 in range(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... | int(input())
s= input()
tmp = False
IN , out = 0 , 0
for i in s.replace('(',')').split(')'):
for ch in i.split('_'):
if tmp :
if ch:
out +=1
else:
IN = max(IN, len(ch))
tmp = not tmp
print(IN , out) |
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
n = int(sys.stdin.readline())
string = sys.stdin.readline().strip()
outside_longest = 0
inside_count = 0
begin = string.find("(", 0)
if begin == -1:
for word in string.split("_"):
if len(word) > outside_longest:
outside_longest = len(word)
else:
for word in string[:begin].spli... |
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()
ans = 0
out = True
cur = 0
for i in xrange(n):
if (s[i] == ')'):
out = True
elif (s[i] == '('):
out = False
if (out and '_()'.find(s[i]) == -1):
cur += 1
else:
cur = 0
ans = max(ans, cur)
p = 0
ans2 = 0
while (True):
np = s.find('(', p)
if (np == -1): break
... |
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;
import java.util.StringTokenizer;
/**
* Created by Kim on 2016-10-03.
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str = sc.next();
int maxLength = 0;
int inPa... |
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 = 0, i = 0, a = 0, x = 0, y = 0, b = 0, c = 0, d = 0;
string s = "";
cin >> n >> s;
for (int i = 0; i < n; i++) {
d = int(s[i]);
if (d == 95) {
x = 0;
if (y > 0) {
c++;
}
y = 0;
}
if (d == 40) {
... |
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()
flag=0
count=0
grag=0
count=0
a=[]
a.append(0)
flag=0
grag=0
for i in range(0,len(s)):
if flag==0 and s[i]!='(' and s[i]!='_':
count+=1
#print i
# print i,count
grag=1
if flag==0 and (s[i]=='(' or s[i]=='_') and grag==1:
#print i,s[i],count
a.append(count)
count=0
if s[i]=='(':
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;
char s[300];
int main() {
int n;
while (cin >> n) {
int flag = 0;
s[0] = '_';
int sum1 = 0, sum2 = 0;
int ans = 0;
for (int i = 1; i <= n; i++) {
cin >> s[i];
if (s[i] == '(') {
flag = 1;
ans = 0;
continue;
}... |
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()
s = raw_input()
get_list = re.split("[_)()]", s)
another_s = ""
inside = False
list1, list2, s1, s2 = [], [], "", ""
for i in s :
if i == '(' :
inside = True
list1.append(s1)
s1 = ""
if i == ')' :
list2.append(s2)
s2 = ""
inside = False
if no... |
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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
Buf... |
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().split('(')
ss=[]
for x in s :
ss+=x.split(')')
A,B = 0,0
for i in range(len(ss)):
if i%2==1:
for x in ss[i].split('_'):
B+=len(x)!=0
else:
for x in ss[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... | import re
n = input()
a = raw_input()
b = re.findall("\(.*?\)", a)
for s in b:
a = a.replace(s, '_')
inw = 0
maxlen = 0
a = a.split('_')
for s in a:
maxlen = max(maxlen, len(s))
for s in b:
cur = s[1:-1]
cur = cur.split("_")
for t in cur:
if t: inw += 1
print maxlen, inw
|
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 in_paren = 0;
int word_length = 0;
int max_len_out = 0;
int num_words_in = 0;
for (int i = 0; i < n; i++) {
char c;
cin >> c;
if (c == '_' || c == '(' || c == ')') {
int last_word_length = word_length;
... |
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;
template <class T>
T max2(T a, T b) {
return a < b ? b : a;
}
template <class T>
T min2(T a, T b) {
return a < b ? a : b;
}
template <class T>
T max3(T a, T b, T c) {
return Max2(Max2(a, b), c);
}
template <class T>
T min3(T a, T b, T c) {
return Min2(Min2(a, b), 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;
vector<long long int> pref(100001);
int main() {
long long int n;
cin >> n;
string s;
cin >> s;
long long int i, j;
stack<char> st;
long long int cnt = 0;
long long int ans1 = 0;
long long int cnt2 = 0;
long long int ans = 0;
for (i = 0; i < n; 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.InputStreamReader;
public class Main {
public static void main(String[] args) {
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String input = br.readLine();
boolean inside = 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 re
input()
sl = input()
fp = False
wc = 0
ol = []
ml = [0]
while sl.count("("):
t = sl[sl.index("("):sl.index(")")+1]
ol+=re.split("[_()]", t)
sl=sl.replace(t, "_",1)
for s in sl.split("_"):
ml.append(len(s))
for o in ol:
if o!='':
wc+=1
print(max(ml),wc) |
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 = int(input())
s = input()
ans1 = 0
ckob = 0
g = []
count = 0
for i in range(a):
if s[i] == "_":
if count > ans1 and not ckob:
ans1 = count
count = 0
if ckob and d:
g.append(d)
d = ""
elif s[i] == "(":
if count > ans1 and not ckob:
... |
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.lang.*;
public class Main {
public static PrintWriter out;
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int length = sc.nextInt();
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... | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.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... | #include <bits/stdc++.h>
int main() {
int len;
char s[1111];
scanf("%d%s", &len, s);
int res1 = 0, res2 = 0;
bool tag = false;
int tmp = 0;
for (int i = 0; i < len; ++i) {
if (s[i] == '(') {
tag = true;
tmp = 0;
} else if (s[i] == ')') {
if (tmp > 0) {
++res2;
}
... |
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 = str(input())
outside, inside = '', ''
p = 0
while p < n:
if s[p] == '(':
pd = p + 1
while pd < n:
if s[pd] == ')':
pd += 1
break
inside += s[pd]
pd += 1
p = pd
inside += '_'
else:
out... |
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()
outs = list()
inside = list()
cnt = 0
flag = 0
count = 0
flag1 = True
flag2 = False
flag3 = True
flag4 = True
for i in range(len(s)):
if s[i] == '(':
flag = 1
elif flag == 1 and s[i] != '(':
if (65 <= ord(s[i]) <= 90) or (97 <= ord(s[i]) <= 122):
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... | import sys
length = sys.stdin.readline()
inp = sys.stdin.readline().strip()
currWordLen = 0
maxOutLength = 0
numWordsIn = 0
inParen = False
for c in inp:
if c=='_':
if inParen and currWordLen>0:
numWordsIn += 1
currWordLen = 0
elif c=='(':
currWordLen = 0
inParen =... |
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;
while (cin >> n) {
char *s = new char[n];
cin >> s;
int cnt = 0, cnt1 = 0, maxlen = 0;
for (int i = 0; i < n; i++) {
if (s[i] != '_' && s[i] != '(') {
cnt++;
} else {
maxlen = max(cnt, maxlen);
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... | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package textdocumentanalysis;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.... |
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 str;
cin >> str;
int m = str.length();
int cnt = 0, count = 0;
bool found = false, ans = false, no = false;
vector<int> a;
a.push_back(0);
for (int i = 0; i < m;) {
if (str[i] == '_') {
i++;
while ((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... | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n;
String s;
n = sc.nextInt();
s = sc.next();
boolean openParathensis = false ;
StringBuilder sb = new StringBuilder();
int maxOutSide = 0;
int nbrInside = 0;
for(int i = 0 ; 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... | n = input()
s = input()
arr = []
brr = []
x = 0
sub = ""
for i in s:
if i=='(':
x = 1
if sub: arr.append(sub)
sub = ""
continue
if i==')':
x = 0
if sub: brr.append(sub)
sub = ""
continue
if i=='_':
if x:
if sub: brr.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... | import java.util.Scanner;
import java.lang.*;
public class cf723b {
static final Scanner sc = new Scanner(System.in);
static int[] documentAnalyser(String doc) {
boolean insideParenthesis = false;
boolean lastWasLetter = false;
int longestLength = 0;
int wordLength = 0;
int wordsInParentheses = 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... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
int t = 0;
int total_w_in = 0;
int total_w_out = 0;
int t_cha = 0;
char a;
for (int i = 0; i < n; ++i) {
cin >> a;
if ((a >= 65 && a <= 90) || (a >= 97 && a <= 122)) {
t_cha++;
}... |
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 MaxWord = 0;
int WordsInBrackets = 0;
int Brackets = 0;
int Word = 0;
for (int i = 0; i < S.size(); i++) {
if (S[i] == '_') {
if (Word > MaxWord) {
MaxWord = Word;
}
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... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
char a[260];
while (~scanf("%d", &n)) {
scanf("%s", a);
int flag = 0;
int temp = 0;
int max_num = 0;
int cnt = 0;
bool isword = false;
for (int i = 0; i < n; i++) {
if (!flag) {
if (('a' <= a[i] && a[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... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from sys import stdin, stdout, argv
from collections import defaultdict, Counter
printer = print
def input():
return stdin.readline().rstrip()
s = input()
s = input().strip('_').rstrip('_').replace('_',' ').split('(')
maxl = 0
count = 0
for i in s:
if ')' in 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())
line = raw_input().strip().replace('(', '_(_').replace(')', '_)_')
inpar = False
maxl = 0
cntin = 0
for word in line.split('_'):
if not word: continue
if word == '(':
inpar = True
continue
elif word == ')':
inpar = False
continue
if inpar:
cntin += 1
else:
maxl = max(maxl, len(wor... |
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... | lens = int(input())
ins = input()
p, t, c, m = 0, 0, 0, 0
for i in range(lens):
if ins[i] == "_":
if p and t: c += 1
if not p and t>m: m = t
t = 0
elif ins[i] == "(":
p = 1
if t > m: m = t
t = 0
elif ins[i] == ")":
p = 0
if t: c += 1
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;
bool func(char ch) {
if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') {
return true;
}
return false;
}
void func1(string s, long long len) {
long long ans = 0;
bool par = 0;
long long index = 0, lans = 0;
while (index < len) {
if (par == 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.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class R375D2P2 {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
bf.readLine();
StringTokenizer st = new StringTokenizer... |
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;
vector<long long> a, b;
int main() {
string s;
long long n;
cin >> n;
cin >> s;
int fl = 0;
long long siz = 0, cnt = 0;
string word;
for (int i = 0; i < s.size(); ++i) {
if ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) {
word += 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, s = int(input()), input()
ma, num, flag, flag2, c = [0 for i in range(5)]
for i in s:
if i == '(' or i == ')':
flag = not (flag)
flag2 = 0
c = 0
elif flag:
if i == '_':
flag2 = 0
elif flag2 == 0:
num += 1
flag2 = 1
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... | l = raw_input()
s = raw_input()
import re
bat = []
for i in re.findall('\((.*?)\)', s):
bat.extend([j for j in i.split('_') if j != ''])
cat = [len(i )for i in re.sub('\((.*?)\)','_', s).split('_')]
print max(cat), len(bat) |
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()
cur = ''
words = []
p = False
for e in s:
if e == '_':
if cur != '':
words.append((cur, p))
# print cur
cur = ''
elif e == '(':
if cur != '':
words.append((cur, p))
cur = ''
p = True
elif e == ')':
if cur != '':
words.append((cur, p))
cur = ''
p = 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... | n=int(input())
s=input()
inside=1
maxlen=0
q=0
word=0
for i in range(n):
if s[i]>='a' and s[i]<='z' or s[i]>='A' and s[i]<='Z':
word+=1
if inside:
if word>maxlen:
maxlen=word
else:
if word:
if inside==0:
q+=1
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... | #include <bits/stdc++.h>
using namespace std;
void rs(int &x) { scanf("%d", &x); }
void rsl(long long &x) { scanf("%I64d", &x); }
void rsd(double &x) { scanf("%lf", &x); }
void rss(char *str) { scanf("%s", str); }
void ws(int &x) { printf("%d ", x); }
void wsl(long long &x) { printf("%I64d ", x); }
void wsd(double &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... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios ::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
string s;
cin >> n >> s;
int ans1 = 0, ans2 = 0, c1 = 0;
bool hp = 0, c2 = 0;
for (int i = 0; i < n; i++) {
if (hp == 0) {
if (isalpha(s[i])) {
c1++;
} 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(input())
s=input()
s1='_'
while s.find('(')!=-1:
beg=s.find('(')
end=s.find(')')
s1=s1+s[beg+1:end]+'_'
s=s[:beg]+'_'+s[end+1:]
a=[len(i) for i in s.split('_') if i]
b=[i for i in s1.split('_') if i]
print(max(a) if len(a)>0 else 0,len(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... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, j, k = 0, cnt = 0, cnt1 = 0, f = 0, f1 = 0, b[300] = {0};
scanf("%I64d", &n);
char a[n];
cin >> a;
for (i = 0; i < n; i++) {
f = 0;
if (a[i] == '(') {
k++;
cnt1 = 0;
for (j = i + 1; a[j] != ')'; j++) {
... |
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()
cnt = 0
mx = 0
c = 0
flg = 0
for x in s:
if x == '_':
if flg == 1 and c > 0:
cnt += 1
c = 0
elif x == '(':
flg = 1
c = 0
elif x == ')':
flg = 0
if c > 0:
cnt += 1
c = 0
else:
c += 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;
char a[260];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
cin >> a;
int x = 0, y = 0, m = 0, flag = 0;
int t = 1, tt;
for (int i = 0; i < n; i++) {
if (a[i] == '(') {
flag = 1;
tt = i;
t = 1;
} else if (a[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()
i,wib,long=0,0,0
f="OUT"
x,y=0,0
while i<n:
if s[i]=="(":
f="IN"
i+=1
continue
elif s[i]==")":
f="OUT"
i+=1
x=0
continue
elif f=="OUT":
if s[i]=='_':
x=0
else:
x+=1
if x>long:... |
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 len, flag = 0, ans1 = 0, ans2 = 0, cnt = 0;
int main() {
scanf("%d", &len);
scanf("%s", s);
for (int i = 0; i < len; i++) {
if (s[i] == '_') {
if ((flag) && (cnt)) ans2++;
if (!flag) ans1 = max(ans1, cnt);
cnt = 0;
} else 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=int(input())
ch= input()
a=[]
b=[]
t=False
for x in ch:
if x=='(':
t=True
b.append('_')
a.append('_')
elif x==')':
t=False
b.append('_')
a.append('_')
if t and(x!='(')and(x!=')') :
b.append(x)
elif(x!='(')and(x!=')'):
a.append(x)
i=0
s=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.*;
public class B {
public static void main(String[]args)throws Throwable{
MyScanner sc=new MyScanner();
int n=sc.nextInt();
String s=sc.next();
boolean started=false;
int cntIn=0;
int len=0;
int maxlen=0;
for(int i=0;i<n;i++){
if(started){
if(s.charAt(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.util.*;
public class B {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
input.nextLine();
String line = input.nextLine();
boolean inside = false;
int maxLenOutside = 0;
int numInside = 0;
StringTokenizer st = new StringTokenizer(li... |
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('(', '_')
s_input = s_input.replace(')', '_')
return [x for x in s_input.split('_') if x != '']
mask = []
i = 0
inside_brackets = False
while i < len(s):
if s[i] == '(': inside_brackets = True
elif s[i] == ')': inside_bracke... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.