Skip to content
Snippets Groups Projects
Commit c7937873 authored by aslesha's avatar aslesha
Browse files

Add new file

parent 448811c4
Branches
No related tags found
No related merge requests found
Pipeline #191 failed
def maximum(s):
max = 0
maxi = 0
n=len(s)
for i in range(n):
if (str[i] == '('):
max+=1;
if(max>maxi):
maxi=max
elif (str[i] == ')'):
if(max > 0):
max-=1;
else:
return -1;
if(max !=0):
print("Not Valid")
return -1;
return maxi;
s=input("Enter a string")
print (maximum(s))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment