I wrote the following code in python, and it showed error while compiling:
def parentheses(oBrac,cBrac):
if cBrac==n:
print("".join§)
return
if oBrac<n:
p.append(’(’)
parentheses(oBrac+1,cBrac)
p.pop()
if oBrac>cBrac:
p.append(’)’)
parentheses(oBrac,cBrac+1)
p.pop()
return
n=int(input())
p=[]
parentheses(0,0)
The code is working fine for custom inputs. The error is:
Traceback (most recent call last):
File “source”, line 15, in
n=int(input())
EOFError: EOF when reading a line