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... | import java.util.*;
import java.io.*;
public class CodeForce {
public static void main(String[] args) {
InputReader in=new InputReader(System.in);
OutputWriter out=new OutputWriter(System.out);
int l=in.nextInt();
String s=in.nextLine();
int longestLength=0;
int currentLenght=0;
int noUnder... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int max = 0, cnt = 0;
StringBuilder... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int N;
string line;
int word_counter = 0;
int MAX_length = 0;
bool inside_parenth = false;
string temp = "";
int main() {
while (cin >> N) {
cin >> line;
for (int i = 0; i < N; i++) {
if (line[i] == '(') {
inside_parenth = true;
if (temp != "... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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()
outside = []
inside = []
tmp = ''
flag = False # outside
for item in s:
if '(' == item:
outside.append(tmp)
tmp = ''
flag = True
elif ')' == item:
inside.append(tmp)
tmp = ''
flag = False
else:
tmp += item
outside.append(tmp)
len_max = 0
cnt = 0
for line in 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... | n = int(input())
s = str(input())
s = s.replace("(", " ( ")
s = s.replace(")", " ) ")
s = s.replace("_", " ")
answer = s.split()
a = 0
b = 0
op = False
for element in answer:
if element == "(":
op = True
elif element == ")":
op = False
else:
if op:
b += 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())
s = raw_input()
flag = 0
longest_outside = 0
temp = 0
#print s
for i in xrange(n):
if s[i] == '(':
flag = 1
elif s[i] == ')':
flag = 0
temp = 0
if s[i] == '_' and flag==0:
temp = 0
elif s[i] != '(' and s[i] != ')' and flag==0:
temp+=1
longest_outside = max(longest_outside, temp)
#pr... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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())
w = list(input().split("("))
max_out_of_brackets = 0
total_words_in_brackets = 0
c = w[0].split("_")
for cur_w in c:
max_out_of_brackets = max(max_out_of_brackets, len(cur_w))
w[0] = ""
for x in w:
c = x.split(")")
c[0] = c[0].split("_")
for cur_w in c[0]:
if len(cur_w) != 0:
total_... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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()
b = 0
groups = re.findall('\([^)]*\)', s)
for group in groups:
b += len(re.findall('[^_]+', group[1:-1]))
a = 0
s = re.sub('\([^)]*\)', ' ', s)
for word in re.findall('[a-zA-Z]+', s):
a = max(a, len(word))
print('%d %d' % (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... | #include <bits/stdc++.h>
using namespace std;
template <class T>
void scanint(T& x) {
register int c = getchar();
x = 0;
int m = 0;
for (; isspace(c); c = getchar())
;
if (c == '-') {
m = 1;
c = getchar();
}
for (; c > 47 && c < 58; c = getchar()) {
x = (x << 1) + (x << 3) + c - 48;
}
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 n, max = 0, num = 0;
char string[300];
cin >> n;
cin >> string;
int check = 0, length = 0;
for (int i = 0; i < n; i++) {
if (string[i] == '(')
check = 1;
else if (string[i] == ')')
check = 0;
if (check == 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... | n = int(input())
s = input()
words = 0
longest = 0
b = False
d = False
count = 0
for i in s:
if i == '(':
b = True
count = 0
if b:
if d and (i == '_' or i == ')'):
words += 1
d = False
if i != '_' and i != ')' and i != '(':
d = True
if not b:
if i != '_' and i != '(' and i != ')':
count += 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>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
int main() {
char a[305];
int n, ff = 0, mx = 0, te = 0, nn = 0;
scanf("%d%s", &n, a);
string s;
for (int i = 0; i < n; i++) {
if (a[i] == '(') {
ff = 1;
mx = max(te, mx);
te = 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() {
int len;
string str;
cin >> len >> str;
int word_cnt = 0;
int max_cnt = 0;
bool is_consec;
is_consec = 0;
bool is_open = 0;
bool is_word = 0;
for (int i = 0; i < len; i++) {
if (str[i] == '(') {
is_open = 1;
}
if (str[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.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class pre93
{
public static void main(String args[])
{
Scanner obj = new Scanner(System.in);
int n = obj.nextInt();
String str = obj.next();
ArrayList<Integer> out = new ArrayList<>(), 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 = input()
s = input()
outside = ""
inside = ""
parentheses = False
for c in s:
if c == "(":
outside += "_"
parentheses = True
elif c == ")":
inside += "_"
parentheses = False
else:
if parentheses:
inside += c
else:
outside += c
mo =... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | f = lambda s: max(map(len, s.split('_')))
g = lambda s: len([e for e in s.split('_') if e])
n = int(input())
s = input()
i = 0
a, b = 0, 0
while i < n:
j = i
while j < n and s[j] != '(': j += 1
a = max(a, f(s[i:j]))
i = j
while j < n and s[j] != ')': j += 1
b += g(s[i + 1:j])
i = j + 1
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... | 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... |
import java.util.*;
public class NewClass1 {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
int n=in.nextInt();
String s=in.next();
boolean b=true;
int c=0,max=0;
int cc=0,max1=0;
for (int 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 Test {
public static void main(String[] args) {
ArrayList<String> arr1 = new ArrayList<>();
ArrayList<String> arr2 = new ArrayList<>();
Scanner in = new Scanner(System.in);
int n, flag = 0;
n = in.nextInt();
String s = "", str = in.next();
str += "^";
n++;
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... | #include <bits/stdc++.h>
using namespace std;
int a, b;
int f(string x) {
int ans = 0;
string var = "";
for (int i = 0; i < ((int)x.size()); i++) {
if (x[i] == '_') {
if (((int)var.size()) == 0)
continue;
else {
ans++;
var = "";
}
} else {
var.push_back(x[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(input())
a = input()
i = 0
maxln = 0
s = 0
while i < len(a):
if a[i] == '(':
j = 0
while True:
if a[i] == ')':
if j != 0:
s += 1
j = 0
break
if a[i] == '_' and j != 0:
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
a = [s.split(')')[::-1] for s in input().split('(')]
x, y = 0, 0
for i in range(len(a)):
if len(a[i]) == 2:
for s in a[i][1].split('_'):
if len(s) > 0:
y += 1
for s in a[i][0].split('_'):
x = max(x, len(s))
print(x, y)
|
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 Main_Round375Div2_B {
private static Scanner sc;
private static Printer pr;
private static void solve() {
int n = sc.nextInt();
String s = sc.next();
String out = "";
String in = "";
for (int i = 0; i < n; ) {
int p = s.indexOf('(', i);
if (p =... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &p) {
return os << "(" << p.first << ", " << p.second << ")";
}
template <typename C, typename T = decay<decltype(*begin(declval<C>()))>,
typename enable_if<!is_same<C, 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 = input()
stri = raw_input()
tmp_letters = 0
inbracket = False
maxlen = 0
word_count = 0
haswords = True
for word in str(stri):
if word == '(':
if tmp_letters > maxlen:
maxlen = tmp_letters
tmp_letters = 0
inbracket = True
haswords = False
if inbracket:
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... | /*
* Author- Priyam Vora
* BTech 2nd Year DAIICT
*/
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
import javax.print.attribute.SetOfIntegerSyntax;
publi... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.lang.*;
public class HelloWorld {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
input.next();
String s = input.next();
String in = "";
String out = "";
boolean inside = false;
for(int i=0; i<s.length(); i++){
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 re
l = input()
S = input()
a = [word for e in re.split(r"\([^()]*\)",S) for word in re.split(r"_+", e)]
b = [word for e in re.findall(r"\([^()]*\)", S) for word in re.split(r"_+", e[1:-1]) if word]
print(str(len(max(a, key=len))) + " " + str(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... | n = int(raw_input())
s = raw_input()
inparenCnt = 0
ret = 0
inParen = False
l = 0
for i in xrange(n):
if s[i] == '(':
inParen = True
ret = max(ret, l)
l = 0
elif s[i] == ')':
inParen = False
if l != 0:
inparenCnt += 1
l = 0
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... | n = int(input())
t = input()
d = set({})
in1 = 0
s1 = set({0})
s2 = set({0})
out1 = 0
count = 0
l = []
for i in t:
# print(s1,count)
if i == "(":
s2.add(out1)
out1 = 0
d.add(i)
elif "(" in d:
if ord(i) >= 65 and ord(i) <= 90 or ord(i) >= 97 and ord(i) <= 122:
# s1.add(i)
in1 = in1 + 1
if i == "_" 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... | a=int(input())
b=input()
c=b
ip=[]
op=[]
nip=0
while len(c):
if c[0]=='_':
c=c[1:]
elif c[0]=='(':
ind=c.find(')')
ip.append(c[1:ind])
c=c[ind+1:]
else:
ind1=c.find('_')
ind2=c.find('(')
if ind1==-1 and ind2==-1:
op.append(len(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;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int co = 0;
int len = 0;
int sum = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
int k = i;
for (; k < n; k++) {
if (s[k] == ')')
break;
else if ((s[k] >= 'A' &... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
f = False
a = b = 0
for chr in s.replace('(',')').split(')'):
for i in chr.split('_'):
if f:
b += len(i) != 0
else:
a = max(a,len(i))
f = not f
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... | n = int(raw_input())
s = raw_input() + "_"
outs = [""]
ins = []
inside = False
word = None
for c in s:
if c == "_":
if word:
if inside:
ins.append(word)
else:
outs.append(word)
word = None
elif c == "(":
if word:
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... | raw_input()
s = raw_input().strip()
a, b = 0, 0
inP = False
begin = -1
pos = -1
for i in s:
pos += 1
if i == '(' or i == ')' or i == '_':
if begin != -1: # End a word
if not inP:
a = max(a, pos - begin)
else:
b += 1
begin = -1
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... | #include <bits/stdc++.h>
int main() {
int n, i, j, c = 0, d, k, u = 0, x = 0, z = 0, y = 0;
scanf("%d", &n);
char s[n];
getchar();
gets(s);
d = strlen(s);
for (i = 0; i < d; i++) {
if (s[i] == '(') {
for (j = i + 1; j < d; j++) {
if (((s[j] == '_') || (s[j] == ')')) &&
(((s[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... | import sys,re
n = int(sys.stdin.readline())
s = sys.stdin.readline()[:-1]
s = s.replace("(","_(")
s = s.replace(")",")_")
lParentesis = []
while (s.find("(") != -1):
lParentesis.append(s[s.find("(")+1:s.find(")")])
s = s[:s.find("(")] + s[s.find(")")+1:]
parentesisWord = [y for x in map(lambda x : x.split("_"),lP... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
long long cmpfunc(const void* a, const void* b) {
return (*(long long*)a - *(long long*)b);
}
int main(void) {
long long int test, i, j, n, count, flag = 0, o1 = 0, o2 = 0, b1, x, m, l,
max, k, sum2, min, f, r, o, sum1, sum = 0,
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... |
n=input()
s=raw_input()
m=0
M=0
for e in s.split('('):
if ')' in e:
f=e.split(')')
M+=len([k for k in f[0].split('_') if k])
if ')' in e:
p=e.split(')')[1]
else:
p=e
for k in p.split('_'):
m=max(len(k),m)
print m,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;
int ln;
char s[100005];
char temp[1005];
bool isAl(char x) {
if (x >= 'a' && x <= 'z' || x >= 'A' && x <= 'Z') return 1;
return 0;
}
void solve() {
int i, lnn, cntTu, tm, maxxln;
bool isP = false;
tm = 0;
cntTu = 0;
maxxln = 0;
cin >> s;
for (i = 0; i <= 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... | n = int(input())
a = input()
b = ""
for i in range(len(a)):
if a[i] == "(":
b = b + "_"
b = b + "("
elif a[i] == ")":
b = b + ")"
b = b + "_"
else:
b = b + a[i]
a = b
def skob(a):
ind = 0
l = []
for i in range(len(a)):
if a[i] == "(" and ind == 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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.StringTokenizer;
public class Solutio... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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;
string a = "";
for (int i = 0; s[i]; ++i) {
if (s[i] == '_')
a += " ";
else if (s[i] == '(')
a += " ( ";
else if (s[i] == ')')
a += " ) ";
else
a += s[i];
}
stringstrea... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | # Description of the problem can be found at http://codeforces.com/problemset/problem/723/B
n = int(input())
s = input()
i_p = False
l = 0
m_l = 0
t_i_p = 0
for c in s:
if c == "(":
m_l = max(m_l, l)
l = 0
i_p = True
elif c == ")":
if l != 0:
t_i_p += 1
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... | lst = []
def dedistyvna(string):
try:
indx = string.index('(')
indx1 = string.index(')')
s = string[indx + 1:indx1]
lst.append(s)
return dedistyvna(string[indx1 + 1:])
except ValueError:
pass
return lst
lst1 = []
inp1 = input()
inp = input()
# frchxilebshi 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())
s=input()
p=[]
for i in range(n):
if s[i]=='(' or s[i]==')':
p.append(i)
#v.append(i)
ans2=c=0
for i in range(0,len(p),2):
c=0
for j in range(p[i]+1,p[i+1]):
if s[j]=='_':
ans2+=c
c=0
else:
c=1
if c==1:
ans2+=1
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... | from math import inf,sqrt,floor,ceil
from collections import Counter,defaultdict,deque
from heapq import heappush as hpush,heappop as hpop,heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left,bisect_right
#for _ in range(int(input())):
n=int(input())
s=input()
inde... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
public class MockvitD {
public static void main(String[] args)throws IOException{
InputReader in = new InputReader(System.in);
PrintWriter out = new Pri... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 inf = 1e9 + 7;
const int MAXN = 300;
int n;
char s[MAXN];
int main() {
scanf("%d\n", &n);
for (int i = 0; i < n; ++i) {
cin >> s[i];
}
int inpar = 0, len = 0, lenm = 0;
bool flag = false;
for (int i = 0; i < n; ++i) {
if (flag) {
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.util.*;
public class B723 {
public static boolean checkInside(int ind, String sentence) {
for (int i = ind; i < sentence.length(); i++) {
if (sentence.charAt(i) == ')') {
return true;
}
if (sentence.charAt(i) == '(') {
return false;
}
}
return false;
}
public static int findL... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | # print ("Input n")
n = int(input())
# print ("Input the string")
st = input()
inparens = 0
longest = 0
while st.find('(') != -1:
left = st.find('(')
right = st.find(')')
middle = st[left+1:right]
parsed = middle.split('_')
for word in parsed:
if word != '':
inparens += 1
s... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int i = 0;
vector<string> in, out;
int b = 0;
while (i < n) {
if (s[i] == '(') {
++b;
++i;
}
if (s[i] == '_') ++i;
string temp = "";
while (i < n && 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 len;
char s[300];
int kqlen, kqsl;
void solve() {
int i;
int chaytg, dk;
kqlen = 0;
kqsl = 0;
dk = 0;
chaytg = 0;
for (i = 0; i < len; i++) {
if (s[i] >= 'A' && s[i] <= 'Z') {
chaytg++;
}
if (s[i] >= 'a' && s[i] <= 'z') {
chaytg++;
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.Arrays;
import java.util.StringTokenizer;
/**
* @author Manoj Khanna
*/
public class B {
private static InputReader in;
private static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
if (Arrays.asList(args).contains("-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... | input()
a=input()
wordScopes=0
longestWord=0
inScope=False
canInScope=False
sum=0
for j in range(len(a)):
i=a[j]
if i=='(': inScope=True
if i==')': inScope=False
if i=='_' or i=='(' or i==')':
if sum>longestWord: longestWord=sum
sum=0
continue
if not inScope:
sum+=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... | input()
l = input().replace(')', '(').split('(')
print(max(len(w) for s in l[::2] for w in s.split('_')),
len([w for s in l[1::2] for w in s.split('_') if w]))
# Made By Mostafa_Khaled |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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
sk=0
maxl=0
c=0
for i in range(len(s)):
if s[i]=='(':
maxl=max(c,maxl)
k=1
c=0
else:
if s[i]=='_':
if k==1 and c>0:
sk+=1
c=0
else:
if k==0:
maxl=max(c,maxl)
c=0
else:
if s[i]==')':
k=0
if c>0:
sk+=1
c=0
else:
c+=1
maxl=max(... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class P723B {
public void run() throws Exception {
next(); // skip 'n'
String s = next();
List<Integer> pi = new ArrayList();
for (int i = 0; i < s.length(); i++) {
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())
s = input()
ans1 = 0
ans2 = 0
para = False
us = False
c = 0
for i in s:
if not para:
if i!='(' and i!='_' and i!=')':
c += 1
else:
ans1 = max(ans1,c)
c = 0
if i=='(':
para = True
else:
if i!='(' and i!='_' and i!=')':
us = True
else:
if us:
ans2 += 1
us = False... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
sc.nextInt();
String s = sc.next();
System.out.println(solve(s));
sc.close();
}
static String 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 = raw_input()
line = raw_input()
line = line.replace(')', '(')
line = '_' + line
line = line.split('(')
maxlength = 0
count_words = 0
for i in range(len(line)):
if i%2 == 0:
words = line[i].split('_')
for word in words:
if len(word) > maxlength:
maxlength = 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... | n = int(input())
s = "_" + input() + "_"
outer = 0
inner = 0
oc, ic = 0, 0
bc = False
for c in s:
if c.isalpha():
if not bc:
oc += 1
else:
ic += 1
else:
outer = max(outer, oc)
if ic:
inner += 1
oc, ic = 0, 0
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... | def f(box):
ret = []
box = box.split('_')
l = 0
for i in box:
if i != '':
l = max(l, len(i))
ret.append(i)
return l, ret
l = int(input())
s = input()
data = [[], []]
ind = 0
open_b = 0
box = ''
mx_one = 0
mx_two = 0
for i in range(l):
if open_b == 0:
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... | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package codeforce;
import java.util.Scanner;
/**
*
* @author mankank
*/
public class TextDocumentAnalysis {
public static 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.io.*;
import java.util.*;
public class _723b {
FastScanner scn;
PrintWriter w;
PrintStream fs;
long MOD = 1000000007;
int N=100000+10;
long mul(long x, long y) {long res = x * y; return (res >= MOD ? res % MOD : res);}
long power(long x, long y) {if (y < 0) return 1; long res ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
bool is_char(char ch) {
if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) return true;
return false;
}
int main() {
int n, i, len;
scanf("%d", &n);
char *string = (char *)malloc((n + 1) * sizeof(char));
scanf("%s", string);
len = strlen(string);
bool open = false;
int ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=int(raw_input())
s=raw_input()
arr=[]
arr2=[]
s2=""
i=0
while i<n:
#for i in xrange(n):
if s[i]=='_':
arr.append(s2)
s2=""
elif s[i]=='(':
arr.append(s2)
s2=""
s3=""
i+=1
while i<n:
#for j in xrange(i+1,n):
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()
ans1 = ans2 = 0
cur = now = 0
for i in s:
if i == '(':
ans1 = max(ans1, cur)
cur = 0
now = 1
elif i == ')':
if cur: ans2 += 1
cur = 0
now = 0
elif i == '_':
if now == 0: ans1 = max(ans1, cur)
elif cur: ans2 += 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;
int n;
cin >> n;
cin >> s;
int c = 0, mx = 0;
bool f = 1;
for (int i = 0; i <= s.size(); i++) {
if (s[i] == '(') f = 0;
if (isalpha(s[i]) && f) {
c++;
} else {
mx = max(mx, c);
c = 0;
}
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.util.Scanner;
import java.lang.Math;
public class Document{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int strLength = scan.nextInt();
String str = scan.next();
String[] insides = str.replaceAll("(\\)|^).*?(\... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
bool isalpha(char ch) {
if (ch >= 'a' && ch <= 'z') return true;
if (ch >= 'A' && ch <= 'Z') return true;
return false;
}
int findwords(string str, int now) {
while (isalpha(str[now])) now++;
return now - 1;
}
int main() {
string str;
int T;
while ((scanf("%... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.Scanner;
public class Prepare {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a;
a = sc.nextInt();
String in = sc.next();
int len = 0;
int tmp = 0;
int count = 0;
boolean bl = false;
boolean prev = false;
for(int i = 0; i < in.length(); 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 code3 {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
int k=input.nextInt();
input.nextLine();
String[] arr=input.nextLine().split("");
String out="";
String in[]=new String[k];
for(int i=0;i<in.length;i++){
in[i]="";
}
int 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.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test1 {
public static void main(String[] args) {
Scanner scan = new Scanner( System.in );
int n = scan.nextInt();
scan.nextLine();
// ArrayList<String> in = new ArrayList<>();
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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>
inline void red(int &x) {
static char ch;
static int f = 1;
while (!isdigit(ch = getchar()))
if (ch == '-') f = -1;
x = ch - '0';
while (isdigit(ch = getchar())) x = x * 10 + ch - '0';
x *= f;
}
const int MAXN = 300;
char s[MAXN];
inline bool isletter(const char &x) { return isu... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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(input())
string = input()
ans1=0
ans2=0
def ischar(a):
ret = False
if a>="a" and a<="z":
ret = True
if a>="A" and a<="Z":
ret = True
return ret
str_start = 1000
in_par = 0
length+=1
string+="_"
for i in range(length):
if string[i] == "(":
in_par = 1
ans1=... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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()
out = True
ln = 0
ans1 = 0
ans2 = 0
for i in s:
if i == '_':
if out:
ans1 = max(ans1, ln)
else:
if ln > 0:
ans2 += 1
ln = 0
elif i in '()':
if out:
ans1 = max(ans1, ln)
else:
if ln > 0:
ans2 += 1
ln = 0
out = not out
else:
ln += 1
if out:
ans1 = max(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... | /**
* Created by iainws on 6/10/16.
*/
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
public class TextAnalysis {
public static void main(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... | input()
l = [x for x in raw_input().replace('_', ' ').replace('(', ' ( ').replace(')', ' ) ').split() if x]
f = False
m = 0
c = 0
for x in l:
if x is '(' or x is ')':
f = not f
elif f:
c += 1
else:
m = max(m, len(x))
print(str(m) + ' ' + str(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... | def main():
from sys import stdin, stdout
i = 0
for line in stdin.readlines():
if (i == 0):
n = int(line)
elif (i == 1):
string = line.rstrip()
i += 1
# print(string)
outside_string = ""
inside_string = ""
outside = []
inside = []
is_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 java.util.Scanner;
public class CodeForcesB {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int letters = in.nextInt();
String str = in.next();
int let=0,maxlet=0,inwords=0;
boolean flag1=true;
fo... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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=""
s2=""
flag=True
for i in range(n):
if s[i]=='(':
flag=False
s1+="_"
continue
elif s[i]==')':
flag=True
s2+="_"
continue
if (not flag):
s2+=s[i]
else:
s1+=s[i]
s1=s1.split('_')
s2=s2.split('_')
inPar=0
for... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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().split('(')
t = []
for i in range(len(s)):
t += s[i].split(')')
a = t[1::2]
b = t[::2]
a1, b1 = 0, 0
for i in b:
for j in i.split('_'):
a1 = max(a1, len(j))
for i in a:
for j in i.split('_'):
if j != "":
b1 += 1
print(a1, b1) |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class B {
public static void main(String[] args) throws Exception {
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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
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 splted_by_o... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.*;
import java.util.*;
import java.lang.*;
public class Problem {
public static void main(String[] args) {
FastReader sc = new FastReader(System.in);
int len = sc.nextInt();
String s = sc.next();
int numInside = 0;
int maxLenWord = 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 n, w, l, sz;
string s;
bool braces;
int main(int argc, char** argv) {
scanf("%d", &n);
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '(') {
braces = true;
for (int j = i + 1; s[j] != ')'; j++) {
if (s[j] != '_' && s[j + 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... | n = input()
string = input()
n = len(string)
longest_len = 0
word_inside = 0
curWord = []
inParen = False
for i in range(n):
if (string[i] == "_"):
if (inParen):
if (len(curWord) > 0):
word_inside += 1
else:
if (len(curWord) > longest_len):
lon... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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
*
* @author Aeroui
*/
public class Main {
public static void main(String[] args) {
InputStream 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... | lst = []
def dedistyvna(string):
try:
indx = string.index('(')
indx1 = string.index(')')
s = string[indx + 1:indx1]
lst.append(s)
return dedistyvna(string[indx1 + 1:])
except ValueError:
pass
return lst
lst1 = []
inp1 = input()
inp = input()
# frchxilebshi 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... | raw_input()
s= raw_input()
c=""
ans1 = 0;
ans2 = 0;
flag = False
for i in range(len(s)):
if flag == False :
if s[i] == '(':
flag = True
ans1 = max(ans1,len(c))
c=""
continue
if s[i] == '_':
ans1 = max(ans1,len(c))
c= ""
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import re
input()
s = input()
re_i = r"(\w+)[^_()]*?(?=\))"
re_o = r"(\w+)[^_()]*?(?=\(|$)"
mi = re.findall(re_i, s)
mo = re.findall(re_o, s)
print(max([len(i) for i in "_".join(mo).split("_")]), len([i for i in "_".join(mi).split("_") if 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... | strlen=int(input())
str=input()
in_parentheses=[]
out_parentheses=[]
index=0
left_flag=0
while(True):
if(index>=strlen):
break
if(str[index]== '('):
out_parentheses.append('(')
left_flag+=1
while(True):
index+=1
if(str[index]=='('):
left... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 math
import time
from collections import defaultdict,deque
from sys import stdin,stdout
from bisect import bisect_left,bisect_right
n=int(input())
s=input()
bracket=False
bracword=0
maxword=0
temp=0
for i in s:
if(i=="_"):
if(not bracket):
maxword=max(temp,maxword)
temp=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... | #!/usr/bin/env python
import sys
N, S = sys.stdin.read().splitlines()
N = int(N)
inside = False
max_len_out = 0
count_in = 0
current = 0
S = S + "_"
for c in S:
if c == "(":
inside = True
if current > max_len_out:
max_len_out = current
current = 0
elif c == ")":
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m = 0;
string s;
cin >> n >> s;
int length = 0, count = 0, l = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '_')
length = 0;
else if (s[i] == '(') {
l = 0;
while (1) {
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.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
String data = sc.nextLine();
n = data.length();
int ans1 = 0;
int ans2 ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 bisect import *
from itertools import *
from collections import *
from operator import *
from math import *
I = lambda: input()
IL = lambda: map(int, raw_input().split())
SL = lambda: raw_input.split()
n = I()
s = raw_input()
def solve(s,inside=[],outside=[]):
if len(s) == 0:
return inside, outside
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... | #include <bits/stdc++.h>
using namespace std;
char str[300];
int main() {
int n;
while (cin >> n) {
scanf("%s", str);
int f1 = 0;
int f2 = 0;
int temp = 0;
int ans1 = 0;
int ans2 = 0;
for (int i = 0; i < n; i++) {
if (str[i] == '(') {
f1 = 1;
if (f2) {
ans... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
ans = []
ans1 = []
f = False
d = ''
for i in range(n):
if s[i] == "(":
f = True
ans.append(d)
d = ""
elif s[i] == ")":
f = False
ans1.append(d)
d = ""
elif not f and s[i] == "_":
ans.append(d)
d= ""
elif f and s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.