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()
s = [i for i in s]
x = []
par = []
for i in range(n):
if s[i]=="(" or s[i]==")":
par.append(i)
for i in range(0,len(par)-1,2):
x.append("".join(s[par[i]+1:par[i+1]]))
for j in range(par[i],par[i+1]+1):
s[j] = "_"
s = "".join(s)
s = s.split("_")
x = "_".join(x)
x = x.split("_")
a = 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())
t = input()
word =''
para=''
u=[]
y=[]
o=0
for i in t:
if i=='(':
o=1
elif i==')':
o=0
if o==1:
if i!='(':
para+=i
if len(word)>0:
y.append(word.split('_'))
word=''
else:
if len(para) > 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.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;
import java.util.TreeMap;
public class B {
public static void main(String[] args) throws 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... | l=input()
s=raw_input().split('(')
a=[]
i=g=n=0
for i in s:
a+=i.split(')')
for i in range(len(a)):
if i%2==0:
for j in a[i].split('_'):
g=max(g,len(j))
else:
for j in a[i].split('_'):
n+=len(j)!=0
print g,n |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=int(input())
s=input().replace("(",")").split(")")
l=0
c=0
for i in s[::2]:
for j in i.split("_"):
l=max(l,len(j))
for i in s[1::2]:
for j in i.split("_"):
if j:
c+=1
print(l,c) |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.Scanner;
public class Codeforces375_2B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = Integer.parseInt(in.nextLine());
String s = in.nextLine();
in.close();
if (n == 0) {
System.out.println("0 0");
return;
}
int max = 0;
int amount = 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... | from sys import stdin
n = int(stdin.readline())
a = stdin.readline().strip()
b = ''
c = ''
cur = ''
for i in a:
if i=='(':
b+= '_' + cur
cur = ''
elif i==')':
c+= '_' + cur
cur = ''
else:
cur += i
if cur:
b+='_'+cur
b = b.split('_')
c = c.split('_')
l = 0
for i 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;
const long long INF = 2e9;
int n, l = 0, w = 0, sl = 0, sr = 0, wds = 0, we = 0, coul = 0;
string s;
int main() {
cin >> n;
cin >> s;
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
sl = 1;
sr = 0;
} else if (s[i] == ')') {
sr = 1;
sl ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | # did not use regular expressions
input('')
s = input('')
def tokenize(s_input):
s_input = s_input.replace('(', '_').replace(')', '_')
return [x for x in s_input.split('_') if x != '']
mask = []
inside_brackets = False
for i, c in enumerate(s):
if c == '(': inside_brackets = True
elif c == ')': insid... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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().split('(')
i,o,ans=[],[],[0]*2
f=0
for a,p in enumerate(s):
if a==0:
for x in p.split('_'):
ans[0]=max(ans[0],len(x))
else:
t=p.split(')')
for x in t[0].split('_'):
if x: ans[1]+=1
for x in t[1].split('_'):
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()
m1,m2=0,0
d=[]
p=0
for i in s:
if i=="_":
if p>0:
d.append(p)
p=0
elif i=="(" or i==")":
if p>0:
d.append(p)
p=0
d.append(i)
else:
p+=1
ch="AZERTYUIOPQSDFGHJKLMWXCVBN"
if s[-1].upper() in ch:
d.app... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input()
isParanthesis = False
out_max = 0
in_max = 0
temp_out_max = 0
for index, char in enumerate(s):
if (isParanthesis and char != ")"):
pass
else:
if (char not in "()_"):
temp_out_max += 1
else:
if (char == "_"):
out_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... | n = int(input())
s = input()
l = list(s)
#print(l)
l1=[]
maxt=0
maxw=0
flag = False
lm=[]
for i in range(len(l)):
if(flag==False and l[i]!='_' and l[i]!='(' and l[i]!=')'):
maxt+=1
lm.append(l[i])
if(flag==False and l[i]=='_'):
l1.append(maxt)
maxt=0
if(l[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... | from collections import deque
n = input()
s = raw_input()
d = deque(s)
cnt = 0
tmpOut = "_"
tmpIn = "_"
for i in range(n):
t = d.popleft()
if t == '(':
cnt += 1
tmpOut += "_"
continue
elif t == ')':
cnt -= 1
tmpIn += "_"
continue
if cnt == 0:
tmpOut += t
elif cnt == 1:
tmpIn += t
Out = list(fi... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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_in = []
words_out = [""]
brackets = False
buff = ""
for i in range(len(s)):
if s[i] in ("(", ")", "_"):
if buff:
if brackets:
words_in.append(buff)
else:
words_out.append(buff)
buff = ""
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()
strings1 = []
strings2 = []
string = ""
f = False
for letter in s:
if letter == '_':
if string and not f:
strings1.append(string)
if f and string:
strings2.append(string)
string = ""
elif letter == '(':
f = True
if stri... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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[100000];
bool pass(char d) { return (d >= 'a' && d <= 'z') || (d >= 'A' && d <= 'Z'); }
int main() {
int n;
scanf("%d", &n);
scanf(" %s", str + 1);
bool in = false;
int ans1 = 0, ans2 = 0;
for (int l = 1, r = 0;;) {
for (l = r + 1; l <= n && str[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... | import math,sys,re,itertools,pprint
ri,rai=lambda:int(input()),lambda:list(map(int, input().split()))
n = ri()
s = input()
out = True
w = 0
r1, r2 = 0, 0
for c in s:
if c in '_()':
if w > 0 and not out:
r2 += 1
w = 0
else:
w += 1
if out:
r1 = max(r1, w)
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static FastReader reader = new FastReader();
public static void main(String[] args) {
int n = Integer.parseInt(reader.nextLine());
int longest = 0;
int wordCnt = ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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())
string = input()
condition = False
temp = string
temp = temp.replace("(", "_")
temp = temp.replace(")", "_")
words = temp.split("_")
a = 0
for x in words:
if x != "":
a += 1
temp = string
for x in range(n):
if string[x] == "(":
y = x
condition = True
elif condition 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()
swb = ''
opened = 0
sib = ''
for sym in s:
if sym == '(':
opened += 1
if sym == ')':
opened -= 1
if opened == 0:
if sym != '(' and sym != ')':
swb += sym
if sym == ')':
swb += '_'
if opened > 0:
if sym != ')' an... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 string
input()
s=input()
a, b=0, 0
while s.find('(')>=0:
l, r=s.find('('), s.find(')')
a=max(a, *map(len, s[:l].split('_')))
b+=sum(1 for t in s[l+1:r].split('_') if t!='')
s=s[r+1:]
a=max(a, *map(len, s.split('_')))
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... | #include <bits/stdc++.h>
using namespace std;
const int N = 100010;
char s[1000];
bool isch(char ch) {
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
}
int main() {
int n;
scanf("%d", &n);
scanf("%s", s);
s[n] = '_';
int nowlen = 0, maxlen = 0, num = 0;
bool in = 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... | import java.util.Scanner;
public class R375Div2B {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt()+1;
String s=in.next()+"_";
String[] stack=new String[n];
int p=0,maxcnt=0,cnt=0,cnt2=0;
for(int i=0;i<n;i++){
if(s.charAt(i)=='_'){
if(p==0){
ma... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 = str(input())
maxWordLengthOutOfBrackets = 0
numberWordInBrackets = 0
inBrackets = False
currentWidth = 0;
for i in range(len(s)):
if(s[i] == '('):
inBrackets = True;
currentWidth = 0;
if(s[i+1] != '_' and s[i+1]!= ')'):
numberWordInBrackets +=1;
elif(s[i] == '... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.Scanner;
public class main2 {
public static void main(String args[]){
Scanner data = new Scanner(System.in);
int n = data.nextInt();
data.nextLine();
String s = data.nextLine();
int count1=0;
int word1=0,word2=0;
int max=0;
int count2=0;
int state=0;
for(int i=0;i<s.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... | #include <bits/stdc++.h>
int main() {
int n, i, c = 0, np = 0, cmax = 0;
scanf("%d", &n);
char A[n];
scanf("%s", A);
int C[n];
for (i = 0; i < n; i++) C[i] = 0;
for (i = 0; i < n; i++) {
while (A[i] != '_' && A[i] != '(' && i < n) {
C[c] += 1;
i++;
}
c++;
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 sun.awt.image.ImageWatched;
import sun.awt.image.IntegerComponentRaster;
import java.io.*;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class M... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n=int(input())
stroka=input()
answer1=0
answer2=0
k=''
count=0
for i in range(0,n):
if stroka[i]=='_':
if (k!='')and(count==0):
if len(k)>answer1:
answer1=len(k)
elif (k!='')and(count==1):
answer2+=1
k=''
elif stroka[i]=='(':
if 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... | import re
n = int(input())
s = str(input())
un = []
br = []
tmp = ""
for i in s:
if i == '(':
un.append(tmp)
tmp = ""
elif i == ')':
br.append(tmp)
tmp=""
else:
tmp+=i
if len(tmp) > 0:
un.append(tmp)
ans = 0
ans2 = 0
for i in br:
for j in i.split('_'):
if j != '':
ans = ans + 1
for i in un:
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 p723b{
public static void main(String []args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String s = in.next();
int lw,wi,w,j;
boolean _in=false;
lw=wi=w=0;
j=-1;
for(int i=0;i<s.length();i++){
char c=s.charAt(i);
if(c=='_' && !_in && lw<i-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... | #include <bits/stdc++.h>
using namespace std;
vector<bool> primes(100006, false);
void sieve() {
for (long long i = 3; i <= 100006; i += 2) {
primes[i] = 1;
}
for (long long i = 3; i <= 100006; i += 2) {
if (primes[i] == 1) {
for (long long j = i * i; j <= 100006; j += i) {
primes[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... | import java.util.InputMismatchException;
import java.io.IOException;
import java.io.PrintWriter;
public class B_375 {
/**************Scanner********************/
static class FastReader {
private byte[] buf = new byte[1024];
private int curChar;
private int snumChars;
public int read() {
if (snumChars ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class codeforces {
public static int Binary(int x,int array[]){
int min=0;
int max=array.length-1;
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... | /**
* DA-IICT
* Author : Savaliya Sagar.
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class q2 {
public static int mod = 1000000007;
static FasterScanner in = new FasterScanner();
static PrintWriter o = new PrintWriter(System.out);
public static void main(String[] args) {
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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>
inline T bigmod(T p, T e, T M) {
long long ret = 1;
for (; e > 0; e >>= 1) {
if (e & 1) ret = (ret * p) % M;
p = (p * p) % M;
}
return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
if (b == 0) return a;
return gcd(b, 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 java.util.*;
import java.io.*;
public class f
{
public static void main(String[] arg) throws IOException
{
new f();
}
char[] s;
int max, amt;
void solve(int idx, boolean inside)
{
if(idx >= s.length) return;
if(s[idx] == '_')
{
solve(idx+1, inside);
return;
}
if(s[idx] == '(')
{
sol... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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;
import java.io.IOException;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer token;
String i... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | l = int(input())
s = input()
left = 0
ans = [0] * 2
current = ""
for i in range(l):
if s[i] == "_":
if current != "":
if left == 0:
ans[0] = max(ans[0], len(current))
else:
ans[1] += 1
#print(1, current)
current = ""
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.io.*;
import java.util.*;
import java.math.*;
public class Check2
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 Cf723B {
public static void main(String args[]) throws IOException {
InputReader in = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = in.nextInt();
char s[] = in.readString().toCharArray();
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 300;
char s[MAXN];
int n;
void solve() {
int maxv = 0, x = 0, y = 0, sum = 0, f = 0;
s[n++] = '_';
s[n] = 0;
for (int i = 0; i < n; ++i) {
if (!f) {
if (s[i] == '_') {
x = 0;
} else if (s[i] != '(') {
x++;
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 sys, re
def solve():
lines = []
for line in sys.stdin:
if 'quit' in line:
break
lines.append(line[:-1])
swords = 0
line = lines[1]
prewords = re.split('\(|\)', line)
count = len(prewords)
for i in range(1,count,2):
allword = prewords[i].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... | /*
* PDPM IIITDM Jabalpur
* Asutosh Rana
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static long MOD = 1000000007;
static Set<Integer> Primes;
static long[][] dp;
public static void main (String[] args) throws java.lang.Exception
{
InputReader in=new ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 TextDocumentAnalysis
{
/************************ SOLUTION STARTS HERE ***********************/
private static void solve(FastScanner s1, PrintWriter out){
int N = s1.nextInt() + 2;
String str = s1.nextLine() + "()";
int max1 = 0 , cnt2 = 0;
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())
a = input()
s = 0
c = 0
mx = 0
c1 = 0
cnt = 0
for i in range(n):
if a[i] == '(':
s = 1
if a[i] == ')':
s = 0
if s == 0 :
if a[i] != '_' and a[i]!='(' and a[i]!= ')' :
c += 1
else :
if c >= mx:
mx = c
c = 0... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | l=int(raw_input())
s=raw_input()
i=0
par=False
ans=0
ans2=0
while i<l:
#print s[i]
if s[i]!='_' and s[i]!='(' and s[i]!=')':
c=0
while i<l and s[i]!='_' and s[i]!=')' and s[i]!='(':
c+=1
i+=1
if par:
ans2+=1
else:
ans=max(ans,c)
if i>=l:
break
if s[i]=='(':
par=True
if s[i]==')':
par=Fals... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | input()
s = input()
w, maxp = 0, 0
cur = 0
inp = False
for c in s:
if c.isalpha():
cur += 1
elif cur > 0:
if inp:
w += 1
cur = 0
if c == "(":
inp = True
if c == ")":
inp = False
if not inp and cur > maxp:
maxp = cur
print(maxp, w)
|
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
s = input() + '_'
b = False
w = 0
countin = 0
m = 0
for i in s:
if i == '_':
if b:
if w!=0:
countin += 1
else:
m = max(m, w)
w = 0
else:
if i == '(':
b = True
m = max(m, w)
w = 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(raw_input())
s = raw_input()
x = s.split('(')
normal = []
paren = []
"""
for e in x:
if e == '':
continue
elif e.find('(') == -1 and e.find(')') == -1:
normal.append(e)
else:
paren.append(e)
print normal
print paren
"""
#print x
normal_check =[]
paren_check =[]
for e in x:
if e.find(')')!=-1:
tmp ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
char a[1000][1000], b[1000][1000];
char s[1000];
int main() {
int count1 = 0, count2 = 0;
int n;
scanf("%d", &n);
scanf("%s", s);
int temp = 0;
int f = 1, flag = 1;
for (int i = 0; i < n; i++) {
if (s[i] == '(') {
int temp1 = 0;
f = 1;
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()
f=False
a=[]
for c in s:
if c=='(':
f=True
if f==False:
a.append(c)
if c==')':
f=False
a.append('_')
a=''.join(a)
b=[len(s) for s in a.split('_') if s!='']+[0]
c=sorted(b)[-1]
al=len(b)-1
d=s.replace('_',' ').replace('(',' ').replace(')',' ')
d=d.split()
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... | #include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
int n, cnt, maxl, curl;
string s;
bool in;
bool letter(char x) {
if (x >= 'a' && x <= 'z') return true;
if (x >= 'A' && x <= 'Z') return true;
return false;
}
int main() {
ios::sync_with_stdio(false);
cin >> n... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int ans;
int main() {
std::ios::sync_with_stdio(false);
int x;
string s;
cin >> x >> s;
int count = 0;
int longerst = 0;
for (int i = 0; i < x; i++) {
if (s[i] == '(') {
while (++i < x && s[i] != ')') {
if (s[i] != '_') {
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... | n, lop, nip, p, c = int(input()), 0, 0, False, 0
for ch in input() + '_':
if ch.isalpha():
c += 1
elif c:
if p:
nip += 1
elif c > lop:
lop = c
c = 0
if ch in '()':
p = not p
print(lop, nip) |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 Kunal
*
*/
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class B375 {
public static void main(String[] args) {
InputReader in = new InputReader();
PrintWriter out = new PrintWrite... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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, length1 = 0, max = 0;
cin >> n;
string s;
cin >> s;
for (int i = 0; i < n; ++i) {
if (i < n && s.at(i) != '_' && s.at(i) != '(')
length1++;
else {
if (max < length1) max = length1;
length1 = 0;
}
if (s.at(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 = 0
previ = 0
mlen = 0
cnt = 0
while(i < n):
if(s[i]=='('):
mlen = max(mlen, i-previ)
j = i+1
while(s[j]!=')'):
j+=1
sub = list(filter(lambda x: x!='', s[i+1:j].split('_')))
cnt += len(sub)
i = j+1
previ = i
c... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.Scanner;
public class Main {
static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
int x = sc.nextInt();
String s = sc.next();
int n = s.length();
char[] str = s.toCharArray();
int maxLength = 0;
int numOfWord = 0;
int currLen = 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(raw_input())
S = raw_input()
a,b = (0,0)
cur,inside = (0,0)
for c in S:
if c == '(':
inside = 1
cur = 0
elif c == ')':
inside = 0
if cur: b+=1
cur = 0
elif c == '_':
if inside and cur: b+=1
cur = 0
else:
cur+=1
if not inside... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.Scanner;
public class TextAnalysis {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x1 = in.nextInt();
String x2 = in.next();
int[] res = analysis(x1, x2);
in.close();
System.out.print(res[0]);
System.out.print(" ");
System.out.print... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import re
n = input()
text = raw_input()
#find inside parentheses
tokens = re.findall('\(.*?\)',text)
strip_tokens = [re.sub('[\(\)]','',x) for x in tokens]
words = []
for token in strip_tokens:
words.extend([x for x in token.split("_") if len(x) > 0])
#find outside parentheses
words_outside = re.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... | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
in.nextLine();
String line = in.nextLine();
int res1 = 0;
int res2 = 0;
int i = 0;
int len = 0;
w... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(input())
a = '_' + input() + '_'
n+= 2
per = 0
left = 0
a1 = []
a2 = []
for j in range(n):
if a[j] == '(':
per = 1
if left != 0:
a2.append(a[left:j])
left = j +1
elif a[j] == ')':
per = 0
a1.append(a[left:j])
left = j+1
elif a[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 java.io.BufferedReader;
import java.io.InputStreamReader;
public class ProblemB {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String str = br.readLine() + "_";
boolean isI... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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
length = int(raw_input())
s = raw_input()
k = re.findall(r'\(\w+\)', s)
count_words = 0
for element in k:
element = element[1:-1]
count_words += len(filter(None, element.split('_')))
t = s.split('(')
for e in range(len(t)):
if ')' in t[e]:
t[e] = t[e][t[e].find(')') + 1:]
u = '_'.join(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... |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
scn.nextInt();
String str = scn.next();
List<Integer> aa = new ArrayList<>();
List<Integer> bb = new ArrayList<>();
boolean skoup = 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.*;
public class friend {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
sc.nextLine();
int len=0,count=0,flag=0;
String s;
s=sc.nextLine();
int temp=0,max=-1,i=0,word=0;
while(i<n)
if(s.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... | a=[int(i) for i in (str(input())).split() ]
#print(a)
a=str(input())
a=a.replace('(',' ( ')
a=a.replace(')',' ) ')
a=a.replace('_',' ')
a=a.split();
maxword=0
wordsin=0
curthing=0
for i in a:
if i=='(':
curthing+=1
continue
if i==')':
curthing-=1
continue
#print("%s %s"%(i,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... | t=input()
a=raw_input()
b=list(a)
c=''
d=''
i=0
while i<t:
if b[i]=='(':
c=c+'_'
d=d+'_'
for j in range(i+1,t):
i=i+1
if b[j]==')':
d=d+'_'
c=c+'_'
break
else:
d=d+b[j]
i=i+1
else:... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | n = int(raw_input().strip())
s = raw_input().strip()
s = ')' + s + '('
n = 0
m = 0
for i in range(0, len(s)):
if s[i] == '(' and i != len(s)-1:
j = s.find(')', i+1)
m += len(filter(lambda x: len(x), s[i+1:j].split('_')))
if s[i] == ')':
j = s.find('(', i+1)
n = max(n, max([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... | import java.util.*;
import java.math.*;
import java.io.*;
public class Main{
static FastReader scan=new FastReader();
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
static int mod(int x,int y)
{
if(x<0)
x=x+(-x/y+1)*y;
return 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... | #include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 10;
int main() {
ios::sync_with_stdio(0);
int n;
cin >> n;
string s;
cin >> s;
s += '_';
int ln = 0, lng = 0, imin = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '(') {
imin = 1;
ln = 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... | #include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, ans, ct, x, y, mx;
char s[550];
int main() {
scanf("%d", &n);
scanf("%s", s + 1), s[0] = '_', x = 0, s[n + 1] = '_';
for (i = 1; i <= n + 1; ++i)
if (s[i] == '_') {
if (!ct) {
if (s[x] != '_' && s[x] != '(' && s[x] != ')')
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.*;
import java.io.*;
public class Test {
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static SpaceCharFilter filter;
private static PrintWriter pw;
private static void soln() {
int n=nextInt()... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 maxOutside = 0;
int countInside = 0;
void updateOut(string &s) {
int len = 0;
for (int i = 0; i < (int)s.size(); i++) {
if (s[i] == '_') {
maxOutside = max(maxOutside, len);
len = 0;
} else
len += 1;
}
maxOutside = max(maxOutside, len);... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | num = int(input())
rrr = raw_input()
mxo = 0
mxb = 0
isbraceword = False
ctnum = 0
for x in range(0,num):
if rrr[x] == '(':
mxo = max(mxo,ctnum)
ctnum = 0
isbraceword = True
elif rrr[x] == '_' or rrr[x] == ')':
if isbraceword:
if ctnum > 0:
mxb = mxb... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
private Scanner in;
private PrintWriter out;
public static void main(String[] args) {
new Main().run();
}
private void run() {
in = new Scanner(System.in);
out = new PrintWriter(System.out);
solve();
in.close();
out.close();... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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.*;
/**
* @author Alexander Tsupko (alexander.tsupko@outlook.com)
* Copyright (c) All rights reserved.
*/
public class B {
private static class Solve {
private static void solve(InputReader in, PrintWriter out) {
int n1 = 0, n2 = 0;
boolean flag = false, let... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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())
string = input()
str1=''
str2=''
index=0
_cond = 0
for i in range(n):
if string[i] == "(":
str1+= string[index:i]+"_"
index=i+1
if string[i] == ")":
str2+= string[index:i]+"_"
index=i+1
if i == n-1 and string[i] != ")":
str1 += string[index:i+1]
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class TextDocumentAnalysis {
public static BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
public static StringTokenizer st;
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... | import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Stri... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | from collections import Counter
n = input()
string = raw_input()
a = ''
b = ''
i = 0
while i<len(string):
if string[i] == '(':
i += 1
while i<len(string) and string[i] != ')':
b += string[i]
i += 1
b += '_'
i += 1
else:
while i<len(string) and string[i] != '(':
a += string[i]
i += 1
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 = input()
n = int(n)
s = input()
s = str(s)
state = 0
c = 0;
l = 0;
w = 0;
for i in s:
if state == 0:
if i == '_':
if c > l:
l = c
c = 0
elif i == '(':
if c > l:
l = c
c = 0
state = 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... | var arr = readline().split(' ');
var len = Number(arr[0]);
arr = readline().split(' ');
var str = arr[0];
var num_in_p = 0;
var max_len = 0;
var tmp_len = 0;
var p_flag = false;
var s_flag = false;
for (var i = 0;i < str.length;i ++) {
if (!s_flag && !p_flag && helper(str[i]) == -1) {
tmp_len ++;
s_flag = true;
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> out;
vector<string> inside;
bool is_ins = false;
char ch;
char ch_prev;
string accum = "";
for (int i = 0; i < n; ++i) {
cin >> ch;
if (ch == '(') {
if (i > 0 && ch_prev != '_' && ch_prev != ')') {... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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() {
char s[10005], r[1005];
int i, w, x, y, fl, c, l;
x = 0;
y = 0;
cin >> l;
cin >> s;
fl = 0;
i = 0;
while (i < l) {
if (s[i] == '_') {
i++;
} else if (s[i] == '(') {
fl = 1;
i++;
} else 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... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
public class start {
static int x[];
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedRead... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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, flag = 0, maxnum = 0, c = 0, c2 = 0, wordstart = 0;
string a;
cin >> n >> a;
for (int i = 0; i < n; i++) {
if (a[i] == '(' && flag == 0) {
maxnum = max(c, maxnum);
flag = 1;
c = 0;
} else if (a[i] == ')' && flag == 1) {
... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, max = 0, ans = 0;
cin >> n;
max = 0;
char a[n];
cin >> a;
for (int i = 0; i < n; i++) {
if (a[i] == '(') {
i++;
while (a[i] != ')' && i < n) {
if (a[i] == '_') {
int count1 = 0;
i++;
while... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the 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 size, i, j;
int max = 0, Word1 = 0, Words = 0, letter = 0, k;
scanf("%d", &size);
char arr[size];
scanf("%s", arr);
i = 0;
if (arr[0] == '(' && arr[size - 1] == ')') {
max = 0;
}
for (i = 0; i < size; i++) {
if (arr[i] != '(') {
while (arr[i] != ... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
long long tavan(long long a, long long b,
long long mod = ((long long)1e9 + 7)) {
long long res = 1;
while (b) {
res *= b % 2 ? a : 1;
res %= mod;
a *= a;
a %= mod;
b /= 2;
}
return res;
}
long long n;
string s;
bool flg = 0;
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;
int main() {
int n, i, maxout = 0, numin = 0, outcur = 0, sig = 1;
char x, y = 0;
cin >> n;
for (i = 0; i < n; i++) {
cin >> x;
if (x == '(') {
sig = 0;
if (outcur > maxout) maxout = outcur;
outcur = 0;
y = x;
continue;
} el... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
bool isSep(char c) { return c == '_' || c == '(' || c == ')'; }
int main() {
int n;
char s[258];
while (scanf("%d", &n) != EOF) {
scanf("%s", s);
int len = 0, maxLen = 0, inPa = 0;
bool paren = false;
for (int i = 0; i < n; i++) {
if (isSep(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... | # your code goes here
a=int(raw_input())
word=raw_input()
al="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def inside(s):
if len(s)==0:
return 0
#print s
diff=0
for i in xrange(1,len(s)-1):
if s[i]=="_":
if s[i-1] in al:
diff+=1
if i==len(s)-2... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | import java.util.ArrayList;
import java.util.Scanner;
public class b {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
ArrayList<String> outside = new ArrayList<>();
ArrayList<String> inside = new ArrayList<>();
int n = scan.nextInt();
scan.nextLine();
String s = scan.nextL... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | readline()
var str = readline()
var inside = ''
!(str.match(/\([^)]*\)/g) || []).forEach(x => {
inside += x.replace(/\(|\)/g, '_')
str = str.replace(x, '_')
})
var lengths = str.split(/\_+/).map(w => w.length)
var words = inside.split(/\_+/).filter(x => x)
print(Math.max.apply(null, lengths) + ' ' + words.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... | n=int(input())
text= input()[:n]
# words_with_paren=input().split('_')
len_long_word_out=0
numb_words_in_paren=0
if '(' in text:
open_ind = [i for i, x in enumerate(text) if x == "("]
close_ind= [i for i, x in enumerate(text) if x == ")"]
for (i,offset) in enumerate(open_ind):
tmp... |
Problem: Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.
In this problem you should implement the similar functionality.
You are given a string which only consists of:
* uppercase and lowercas... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, j, wordCount = 0, inParCount = 0, wordLen = 0, maxSize = 0;
string s;
scanf("%d\n", &n);
getline(cin, s);
bool inPar = false;
bool openUnder = false;
for (i = 0; i < n; i++) {
if (((s[i] >= 'A') && (s[i] <= 'Z')) || ((s[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... | #include <bits/stdc++.h>
using namespace std;
const int N = 3e2 + 9;
int n;
char a[N];
void home() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
void enter() { cin >> n; }
bool check(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); }
void solve() {
bool ok = false;
int... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.