ZhenlongDai/ACPR huggingface dataset:
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

count = 0
maxcount = 0
for i in range(N):
    if S[i] == ")":
        count += 1
        maxcount = max(count, maxcount)
    else:
        count -= 1

if maxcount > 0:
    S = "(" * maxcount + S

count = 0
maxcount = 0

for i in range(len(S)):
    if S[i] == "(":
        count += 1
        maxcount = max(count, maxcount)
    else:
        count -= 1

if maxcount > 0:
    S += ")" * maxcount

print(S)


Failing test case input:
8
))(()(()

Expected output:
(())(()(()))


Actual output:
(())(()(())))


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

count = 0
maxcount = 0
for i in range(N):
    if S[i] == ")":
        count += 1
        maxcount = max(count, maxcount)
    else:
        count -= 1

if maxcount > 0:
    S = "(" * maxcount + S

count = 0
maxcount = 0

for i in range(len(S)):
    if S[i] == "(":
        count += 1
    else:
        count -= 1

if count > 0:
    S += ")" * count

print(S)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
r=0;l=0
for i in s:
    if i=="(":
        r+=1
    else:
        l+=1
print("("*l+s+")"*r)


Failing test case input:
8
()((()((

Expected output:
()((()(())))


Actual output:
((()((()(())))))


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
r=0;l=0
for i in s:
    if i=="(":
        r+=1
    else:
        if r==0:
            l+=1
            continue
        r-=1
print("("*l+s+")"*r)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
ans = ""
cur = 0
for i in s:
  if i == "(":
    ans += "("
    cur += 1
    ans += i
  else:
    if cur:
      ans += i
      cur -= 1
    else:
      ans = "(" + ans
ans += ")" * cur
print(ans)

Failing test case input:
8
()((()((

Expected output:
()((()(())))


Actual output:
(()(((((()(((())))


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
ans = ""
cur = 0
for i in s:
  if i == "(":
    cur += 1
    ans += i
  else:
    if cur:
      ans += i
      cur -= 1
    else:
      ans = "(" + ans + i
ans += ")" * cur
print(ans)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n=int(input())
s=input()
ss=s
l_cnt=0
r_cnt=0
if s.count('()')>0:
    
    while ss.count('()')>0:
        ss=ss.replace('()','')
    l_cnt=ss.count('(')
    r_cnt=ss.count(')')
    if l_cnt>r_cnt:
        s+=')'*(l_cnt-r_cnt)
    elif l_cnt==r_cnt:
        s+=')'*l_cnt
        s='('*r_cnt+s
        
        
        
    elif l_cnt<r_cnt:
        s='('*(r_cnt-l_cnt)+s
    print(s)
else:
    l_cnt=s.count('(')
    r_cnt=s.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s
    print(s)

Failing test case input:
8
))())(()

Expected output:
((())())(())


Actual output:
(())())(()


Fixed submission (verdict: Accepted):

n=int(input())
s=input()
ss=s
l_cnt=0
r_cnt=0
if s.count('()')>0:
    
    while ss.count('()')>0:
        ss=ss.replace('()','')
    l_cnt=ss.count('(')
    r_cnt=ss.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s

    print(s)
else:
    l_cnt=s.count('(')
    r_cnt=s.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s
    print(s)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations
    
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    

    

    N = int(input())
    S = list(input())
    res = 0
    for i in S:
        if i == ')':
            res += 1
        else:
            break
    add = S[res:].count('(')-S[res:].count(')')
    if add>=0:
        for _ in range(add):
            S.append(')')
        print('('*res+''.join(S))
    else:
        print('('*(res-add)+''.join(S))




if __name__ == '__main__':
    main()

Failing test case input:
8
()((()((

Expected output:
()((()(())))


Actual output:
()((()((
))))


Fixed submission (verdict: Accepted):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations
    
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    

    


    N = int(input())
    S = input().rstrip()
    t = S
    while 1:
        a = len(t)
        s = t.split('()')
        s = ''.join(s)
        if len(s)==a:
            break
        t = s
    left = s.count(')')
    right = s.count('(')
    print('('*left + S + ')'*right)

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    




if __name__ == '__main__':
    main()
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
N = int(stdin.readline().rstrip())
S = (stdin.readline().rstrip())
stack = []
l = 0
r = 0
for i in range(N):
    if S[i] == "(":
        stack.append(1)
    elif S[i] == ")":
        if not stack:
            r += 1
        else:
            stack.pop()

l = len(stack)
print(l*"(" + S + r*")")

Failing test case input:
8
)())()()

Expected output:
(()())()()


Actual output:
)())()()))


Fixed submission (verdict: Accepted):
from sys import stdin
N = int(stdin.readline().rstrip())
S = (stdin.readline().rstrip())
stack = []
l = 0
r = 0
for i in range(N):
    if S[i] == "(":
        stack.append(1)
    elif S[i] == ")":
        if not stack:
            l += 1
        else:
            stack.pop()

r = len(stack)
print(l*"(" + S + r*")")

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
s = input()
cnt = 0
for _s in s[::-1]:
    if _s == ")":
        break
    else:
        cnt += 1
s += ")" * cnt
cnt = 0
for _s in s:
    if _s == "(":
        break
    else:
        cnt += 1
s = "(" * cnt + s
ct = Counter(s)

if ct.get("(") is None:
    ct["("] = 0
if ct.get(")") is None:
    ct[")"] = 0
if ct[")"] > ct["("]:
    s = "(" * (ct[")"] - ct["("]) + s
else:
    s = s + ")" * (ct["("] - ct[")"])
print(s)

Failing test case input:
8
)())((()

Expected output:
(()())((()))


Actual output:
()())((())


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
s = input()
cnt = 0
_max = 0
for _s in s[::-1]:
    if _s == ")":
        cnt -= 1
    else:
        cnt += 1
    _max = max(cnt, _max)
s += ")" * _max

cnt = 0
_max = 0
for _s in s:
    if _s == "(":
        cnt -= 1
    else:
        cnt += 1
    _max = max(cnt, _max)
s = "(" * _max + s
ct = Counter(s)

if ct.get("(") is None:
    ct["("] = 0
if ct.get(")") is None:
    ct[")"] = 0
if ct[")"] > ct["("]:
    s = "(" * (ct[")"] - ct["("]) + s
else:
    s = s + ")" * (ct["("] - ct[")"])
print(s)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

d = S.replace('()','')

l = d.count('(')
r = d.count(')')

z = '('*r + S + ')'*l

print(z)

Failing test case input:
8
(()))())

Expected output:
(((()))())


Actual output:
((((()))()))


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

d = S
while d.count('()')!=0:
	d = d.replace('()','')

l = d.count('(')
r = d.count(')')

z = '('*r + S + ')'*l

print(z)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
l = 0
r = 0
for i in range(N):
  if S[i] == ')':
    if r > 0:
      r+=1
    else:
      l+=1
  else:
    r+=1
for _ in range(l):
  print('(', end='')
print(S, end='')
for _ in range(r):
  print(')', end='')

Failing test case input:
6
)()())

Expected output:
(()()())


Actual output:
()()()))))))

Fixed submission (verdict: Accepted):
N = int(input())
S = input()
l = 0
r = 0
for i in range(N):
  if S[i] == ')':
    if r > 0:
      r-=1
    else:
      l+=1
  else:
    r+=1
for _ in range(l):
  print('(', end='')
print(S, end='')
for _ in range(r):
  print(')', end='')

Problem: p03696
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    
    import sys
    input = lambda:sys.stdin.readline().strip()
    N = int(input())
    S = input()
    
    
    right=0
    left=0

    for i in range(N):
        if S[i]=='(':
            right+=1
        else:
            left+=1
    ans=S
    if left<right:
        ans=S+(right-left)*')'
    if left>right:
        ans='('*(left-right)+S
    if left==right:
        ans='('*(right)+S+')'*(left)
    print(ans)

if __name__=='__main__':
    main()

Failing test case input:
6
()(())

Expected output:
()(())


Actual output:
(((()(()))))


Fixed submission (verdict: Accepted):
def main():
    
    import sys
    input = lambda:sys.stdin.readline().strip()
    N = int(input())
    S = input()
    
    
    right=0
    left=0

    for i in range(N):
        if S[i]=='(':
            right+=1
        else:
            if right:
                right-=1
            else:
                left+=1
    print(left*'('+S+right*')')

if __name__=='__main__':
    main()

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
L,R,x = 0,0,0
for i in range(N):
    if x == 0:
        if S[i]==")":
            L += 1
        else:
            R += 1
            x += 1
    else:
        if S[i]==")":
            R -= 1
            x -= 1
        else:
            R += 1
print("("*L + S + ")"*R)

Failing test case input:
8
))(())()

Expected output:
(())(())()


Actual output:
((())(())())


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
L,R,x = 0,0,0
for i in range(N):
    if x == 0:
        if S[i]==")":
            L += 1
        else:
            R += 1
            x += 1
    else:
        if S[i]==")":
            R -= 1
            x -= 1
        else:
            R += 1
            x += 1
print("("*L + S + ")"*R)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

d = []
o = c = 0
for i in range(N):
    if S[i] == '(':
        o += 1
    else:
        c += 1
    d.append(o - c)
x = min(d)
print('(' * -x + S + ')' * (d[-1] - x))


Failing test case input:
8
((((()))

Expected output:
((((()))))


Actual output:
((((())))


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

d = [0]
o = c = 0
for i in range(N):
    if S[i] == '(':
        o += 1
    else:
        c += 1
    d.append(o - c)
x = min(d)
print('(' * -x + S + ')' * (d[-1] - x))
Problem: p03696
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
s = input()
t = 0
ss = 0
ee = 0

if s[0] == ')' and s[-1] == '(':
    for i in range(n):
        if s[i] == ')':
            ss += 1
        else:
            break
    st = s[::-1]
    for i in range(n):
        if st[i] == '(':
            ee += 1
        else:
            break

for i in range(n):
    if s[i] == '(':
        t += 1
    else:
        t -= 1
if t >= 0:
    tail = ')'*(t)
    ans = s+tail
else:
    head = '('*(-t)
    ans = head+s
print('('*ss+ans+')'*ee)


Failing test case input:
8
())))()(

Expected output:
(((())))()()


Actual output:
((())))()(


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
c = 0
d = 0
for i in range(n):
    if s[i] == '(':
        c += 1
    else:
        d += 1
used_c = [True]*n
used_d = [True]*n
for i in range(n):
    if s[i] == '(':
        for j in range(i+1, n):
            if s[j] == ')' and used_c[j]:
                c -= 1
                used_c[j] = False
                break
    else:
        for j in range(i):
            if s[j] == '(' and used_d[j]:
                d -= 1
                used_d[j] = False
                break
print('('*d+s+')'*c)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
nl = 0
nr = 0
for i in S:
    if i == ')':
        if nr > 0:
            nr -= 1
        else:
            nl += 1
    else:
        nr += 1
print(nr)
print(nl)
print('('*nl + S + ')'*nr)


Failing test case input:
8
)))))(()

Expected output:
((((()))))(())


Actual output:
1
5
((((()))))(())


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
nl = 0
nr = 0
for i in S:
    if i == ')':
        if nr > 0:
            nr -= 1
        else:
            nl += 1
    else:
        nr += 1
print('('*nl + S + ')'*nr)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
i = 0
k = 0
while i < len(s):
  if s[i] == "(":
    k += 1
    i += 1
  else:
    if k > 0:
      k -= 1
      i += 1
    else:
      s = s[:i] + "(" + s[i:]
print(s+")"*k)  

Failing test case input:
8
())))()(

Expected output:
(((())))()()


Actual output:
()()()()()()


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
i = 0
k = 0
while i < len(s):
  if s[i] == "(":
    k += 1
  else:
    if k > 0:
      k -= 1
    else:
      s = "(" + s
      i += 1
  i += 1
print(s+")"*k)
Problem: p03696
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
S = input()

left = ''
right = ''

j = 0
skip_idx = []
for idx, s in enumerate(S):
    if idx in skip_idx:
        continue
    if s == ')':
        left += '('
    else:
        
        for n in range(max(idx, j), N):
            if S[n] == ')':
                skip_idx.append(n)
                break
        j = n
        if j == N-1:
            right += ')'
    

print(left+S+right)

Failing test case input:
8
)))))(()

Expected output:
((((()))))(())


Actual output:
((((()))))(()))


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

left = ''
right = ''

skip_idx = []
for idx, s in enumerate(S):
    if idx in skip_idx:
        continue
    if s == ')':
        left += '('
    else:
        
        skip_flag = 0
        for n in range(idx+1, N):
            if n in skip_idx:
                continue
            if S[n] == ')':
                skip_idx.append(n)
                skip_flag = 1
                break
        if not skip_flag:
            right += ')'
    

print(left+S+right)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
n = len(s)
l = 0
r = 0
flag = True
for i in range(n):
  if(s[n-1-i] == '(' and flag == True):
    continue
  elif(s[n-1-i] == ')'):
    flag = False
    r += 1
  else:
    l += 1
d1 = max(0,r-l)

l = d1
r = 0

for i in range(n):
  if(s[i] == ')'):
    r += 1
  else:
    l += 1

d2 = max(0,l-r)

for i in range(d1):
  print('(',end = '')
print(s,end='')
for i in range(d2):
  print(')',end = '')
print('')

Failing test case input:
8
))()(()(

Expected output:
(())()(()())


Actual output:
())()(()()


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
n = len(s)
l = 0
r = 0
tmp = 0
for i in range(n):
  if(s[n-1-i] == ')'):
    tmp += 1
  else:
    tmp -= 1
    if(tmp < 0):
      tmp = 0
      r += 1
tmp = 0
for i in range(n):
  if(s[i] == '('):
    tmp += 1
  else:
    tmp -= 1
    if(tmp < 0):
      tmp = 0
      l += 1


for i in range(l):
  print('(',end = '')
print(s,end='')
for i in range(r):
  print(')',end = '')

Problem: p03696
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
S = input()

left = 0
max_left = 0

for i in S:
    if i == ')':
        left += 1
    else:
        left -= 1
    max_left = max(max_left, left)

right = 0
max_right = 0

for i in S[::-1]:
    if i == '(':
        right += 1
    else:
        right -= 1
    max_right = max(max_right, right)

ans = '(' * left  + S +  ')' * right

print(ans)

Failing test case input:
8
)(((())(

Expected output:
()(((())()))


Actual output:
)(((())())


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

left = 0
max_left = 0

for i in S:
    if i == ')':
        left += 1
        max_left = max(max_left, left)
    else:
        left -= 1

right = 0
max_right = 0

for i in S[::-1]:
    if i == '(':
        right += 1
        max_right = max(max_right, right)
    else:
        right -= 1

ans = '(' * max_left  + S +  ')' * max_right

print(ans)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = ''
    cnt = 0
    for s in S[::-1]:
        if s == ')':
            res += ')'
            cnt += 1
        else:
            if cnt:
                res += '('
                cnt -= 1
            else:
                res += ')('

    res += '(' * max(cnt, 0)
    print(res[::-1])

if __name__ == '__main__':
    main()

Failing test case input:
6
))(()(

Expected output:
(())(()())


Actual output:
(())()()()


Fixed submission (verdict: Accepted):
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = S[:]

    pls_left = 0
    pointer = 0
    for s in S:
        if s == '(':
            pointer += 1
        else:
            if pointer == 0:
                pls_left += 1
            else:
                pointer -= 1

    pls_right = pointer
    res = '(' * pls_left + S
    res += ')' * pls_right

    print(res)

if __name__ == '__main__':
    main()

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=input()

x=0
y=0

for i in S:
    if i=="(":
        x+=1
    else:
        if x<=0:
            y+=1
        else:
            x-=1

Failing test case input:
8
))))(()(

Expected output:
(((())))(()())


Actual output:

Fixed submission (verdict: Accepted):
N=int(input())
S=input()

x=0
y=0

for i in S:
    if i=="(":
        x+=1
    else:
        if x<=0:
            y+=1
        else:
            x-=1
print("("*y+S+")"*x)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input().strip()

replaced = S.replace('()', '')
ans = ''
ans += '(' * list(replaced).count(')')
ans += S
ans += ')' * list(replaced).count('(')

print(ans)


Failing test case input:
8
)(()))))

Expected output:
(((()(()))))


Actual output:
((((()(())))))


Fixed submission (verdict: Accepted):
N = int(input())
S = input().strip()

replaced = S
while '()' in replaced:
    replaced = replaced.replace('()', '')

ans = ''
ans += '(' * list(replaced).count(')')
ans += S
ans += ')' * list(replaced).count('(')

print(ans)
Problem: p03696
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
s = input()
t = 0
ss = 0
ee = 0

if s[0] == ')' and s[-1] == '(':
    for i in range(n):
        if s[i] == ')':
            ss += 1
        else:
            break
    st = s[::-1]
    for i in range(n):
        if st[i] == '(':
            ee += 1
        else:
            break

for i in range(n):
    if s[i] == '(':
        t += 1
    else:
        t -= 1
t -= (ee-ss)
if t >= 0:
    tail = ')'*(t)
    ans = s+tail
else:
    head = '('*(-t)
    ans = head+s
print('('*ss+ans+')'*ee)


Failing test case input:
8
)((())()

Expected output:
()((())())


Actual output:
)((())()


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
c = 0
d = 0
for i in range(n):
    if s[i] == '(':
        c += 1
    else:
        d += 1
used_c = [True]*n
used_d = [True]*n
for i in range(n):
    if s[i] == '(':
        for j in range(i+1, n):
            if s[j] == ')' and used_c[j]:
                c -= 1
                used_c[j] = False
                break
    else:
        for j in range(i):
            if s[j] == '(' and used_d[j]:
                d -= 1
                used_d[j] = False
                break
print('('*d+s+')'*c)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

left = 0
right = 0
for i in range(N):
    if(S[i] is ")"):
        left += 1
    else:
        score = 0
        for j in range(i, N):
            score += 1 if S[j] is ")" else -1
        if score > 0:
            left += score
        else:
            right -= score
        break

for i in range(left):
    S = "(" + S
for i in range(right):
    S = S + ")"
print(S)


Failing test case input:
6
())(()

Expected output:
(())(())


Actual output:
())(()


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
left = 0
right = 0
score = 0
for i in range(len(S)):
    if(S[i] is "("):
        if(score < 0):
            left -= score
            score = 1
        else:
            score += 1
    else:
        score -= 1

if(score < 0):
    left -= score
else:
    right += score

for i in range(left):
    S = "(" + S
for i in range(right):
    S = S + ")"
print(S)

Problem: p03696
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
S = input()
now = 0
right = 0
left = 0
add_left = 0
while now < N:
    if S[now] == '(':
        left += 1
    else:
        if left:
            left -= 1
        else:
            add_left += 1
    now += 1
for _ in range(add_left):
    print('(', end='')
print(S, end='')
for _ in range(left):
    print(')', end='')
print()
print('(((()))())')


Failing test case input:
8
())(((((

Expected output:
(())((((()))))


Actual output:
(())((((()))))
(((()))())


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
now = 0
right = 0
left = 0
add_left = 0
while now < N:
    if S[now] == '(':
        left += 1
    else:
        if left:
            left -= 1
        else:
            add_left += 1
    now += 1
for _ in range(add_left):
    print('(', end='')
print(S, end='')
for _ in range(left):
    print(')', end='')
Problem: p03696
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = list(input())

c0 = 0
c1 = 0
z0 = 0
z1 = 0
for i in range(n):
    if s[i] == "(":
        c0 += 1
    else:
        if c0 > 0:
            c0 -= 1
        else:
            c1 += 1
z0 = c1
s = s[::-1]
for i in range(n):
    if s[i] == ")":
        c1 += 1
    else:
        if c1 > 0:
            c1 -= 1
        else:
            c0 += 1
z1 = c0
s = s[::-1]
ans = ["("]*z0 + s + [")"]*z1
print("".join(ans))

Failing test case input:
6
()((()

Expected output:
()((()))


Actual output:
()((()))))


Fixed submission (verdict: Accepted):
n = int(input())
s = list(input())

c0 = 0
c1 = 0
z0 = 0
z1 = 0
for i in range(n):
    if s[i] == "(":
        c0 += 1
    else:
        if c0 > 0:
            c0 -= 1
        else:
            c1 += 1
z0 = c1
s = s[::-1]
c0 = 0
c1 = 0
for i in range(n):
    if s[i] == ")":
        c0 += 1
    else:
        if c0 > 0:
            c0 -= 1
        else:
            c1 += 1
z1 = c1
s = s[::-1]
ans = ["("]*z0 + s + [")"]*z1
print("".join(ans))

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
d = 0
x = n
for si in s:
    if si == "(":
        d += 1
    else:
        d -= 1
    x = min(d, x)
print("(" * -x + s + ")" * (d - x))

Failing test case input:
8
((((()))

Expected output:
((((()))))


Actual output:
((((())))


Fixed submission (verdict: Accepted):
input()
s = input()
d = 0
x = 0
for c in s:
    if c == "(":
        d += 1
    else:
        d -= 1
    x = min(d, x)
print("(" * -x + s + ")" * (d - x))

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=input()
stack= []
ans=""

for i in range(N):
  if S[i]=="(":
    stack.append(S[i])
  else:
    if len(stack)>0:
      ans = stack.pop()+ ans + ")"
    else:
      ans = "(" + ans + ")"

nokori=len(stack)
ans += nokori * "(" + nokori * ")"

print(ans)

Failing test case input:
6
))))()

Expected output:
(((())))()


Actual output:
((((()))))


Fixed submission (verdict: Accepted):
N=int(input())
S=input()
stack= []
ans=""
L=0
R=0

for i in range(N):
  if S[i]=="(":
    stack.append(S[i])
  else:
    if len(stack)>0:
      stack.pop()
    else:
      L += 1

R=len(stack)
ans = L * "(" + S + R * ")"

print(ans)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n=int(input())
s=input()
ss=s
l_cnt=0
r_cnt=0
if s.count('()')>0:
    ss=ss.replace('()','')
    l_cnt=ss.count('(')
    r_cnt=ss.count(')')
    if l_cnt>r_cnt:
        s+=')'*(l_cnt-r_cnt)
    elif l_cnt==r_cnt:
        s+=')'*l_cnt
        s='('*r_cnt+s
    elif l_cnt<r_cnt:
        s='('*(r_cnt-l_cnt)+s
    print(s)
else:
    l_cnt=s.count('(')
    r_cnt=s.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s
    print(s)


Failing test case input:
6
))())(

Expected output:
((())())()


Actual output:
(())())(


Fixed submission (verdict: Accepted):

n=int(input())
s=input()
ss=s
l_cnt=0
r_cnt=0
if s.count('()')>0:
    
    while ss.count('()')>0:
        ss=ss.replace('()','')
    l_cnt=ss.count('(')
    r_cnt=ss.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s

    print(s)
else:
    l_cnt=s.count('(')
    r_cnt=s.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s
    print(s)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    S = input().replace(")(", ") (").split()
    left = ""
    right = ""
    for s in S:
        i = s.count("(")
        j = s.count(")")
        if i >= j:
            left += "(" * i + ")" * j
            right += ")" * (i - j)
        else:
            left += "(" * i + ")" * j
            left = "(" * (j - i) + left

    ans = left + right
    print(ans)


if __name__ == "__main__":
    main()


Failing test case input:
8
()(()())

Expected output:
()(()())


Actual output:
(()(()()))


Fixed submission (verdict: Accepted):
import sys
from collections import deque

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    S = input()
    stack = deque([])
    left = 0
    for s in S:
        if s == "(":
            stack.append(s)
        else:
            if len(stack) == 0:
                left += 1
            else:
                _ = stack.pop()

    right = len(stack)
    ans = "(" * left + S + ")" * right
    print(ans)


if __name__ == "__main__":
    main()

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = list(input())
m = 0
c1, c2 = 0, 0
for i in range(n):
    if s[i] == ")":
        m += 1
        c2 = c1
    else:
        c1 += 1
j = 0
while True:
    if j == n:
        break
    if s[j] == "(":
        break
    j += 1
l = max((m - c2), j)
s1 = ["("] * l
for i in s:
    if i == "(":
        l += 1
    else:
        l -= 1
s2 = [")"] * l
s = s1 + s + s2
print("".join(s))

Failing test case input:
6
())(()

Expected output:
(())(())


Actual output:
())(()


Fixed submission (verdict: Accepted):
n = int(input())
s = list(input())
m = 0
l = 0
for i in range(n):
    if s[i] == ")":
        m += 1
    else:
        m -= 1
    if l < m:
        l = m
s1 = ["("] * l
for i in s:
    if i == "(":
        l += 1
    else:
        l -= 1
s2 = [")"] * l
s = s1 + s + s2
print("".join(s))
Problem: p03696
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def main():
    n = int(input())
    s = input().replace(')(', ') (').split()
    ans = ''
    for a in s:
        tmp = a
        lc = a.count('(')
        rc = a.count(')')
        if lc < rc:
            ans = '('*(rc - lc) + ans
        elif rc < lc:
            tmp += ')'*(lc - rc)
        ans += tmp
    print(ans)


if __name__ == "__main__":
    main()


Failing test case input:
8
()((()((

Expected output:
()((()(())))


Actual output:
()((()))(())


Fixed submission (verdict: Accepted):
def main():
    n = int(input())
    s = input()
    l, r, c = 0, 0, 0
    for a in s:
        if a == '(':
            c += 1
        else:
            if c:
                c -= 1
            else:
                l += 1
    r = c
    print("("*l + s + ")"*r)


if __name__ == "__main__":
    main()

Problem: p03696
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from itertools import accumulate
N = int(input())
S = input()
SS = [1 if S[i]=='(' else -1 for i in range(N)]
SSS = list(accumulate(SS))
m = -min(SSS)

print('('*m+S+')'*(m+SSS[-1]))


Failing test case input:
8
(()((()(

Expected output:
(()((()())))


Actual output:
(()((()()))


Fixed submission (verdict: Accepted):
from itertools import accumulate
N = int(input())
S = input()
SS = [1 if S[i]=='(' else -1 for i in range(N)]
SSS = list(accumulate(SS))
m = max(0,-min(SSS))
M = SSS[-1]
print('('*m+S+')'*(M+m))

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N=int(input())
S=list(input())

l=0
r=0
pl=0
pr=0


for i in range(N):
    if S[i]==")":
        r+=1
        if l<r:
            pl+=1
        else:
            pr-=1
    else:
        l+=1
        pr+=1

sl=["(" for i in range(pl)]
sr=[")" for i in range(pr)]

ans=sl + S + sr

print("".join(ans))

Failing test case input:
6
)))(()

Expected output:
((()))(())


Actual output:
(((()))(()))


Fixed submission (verdict: Accepted):

N=int(input())
S=list(input())

l=0
r=0
pl=0
pr=0


for i in range(N):
    if S[i]==")":
        r+=1
        if pl+l<r:
            pl+=1
        else:
            pr-=1
    else:
        l+=1
        pr+=1

sl=["(" for i in range(pl)]
sr=[")" for i in range(pr)]

ans=sl + S + sr

print("".join(ans))

Problem: p03696
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
s=input()

result=""
cnt=0


for ss in s:
    if ss ==")":
        if cnt>0:
            result+=ss
            cnt-=1
        else:
            result="("+result+ss
    else:
        result+=ss
        cnt+1

L=result.count("(")
R=result.count(")")

result+=")"*(L-R)

print(result)

Failing test case input:
8
)((())))

Expected output:
(()((())))


Actual output:
((((()((()))))))


Fixed submission (verdict: Accepted):
n=int(input())
s=input()

result=""
cnt=0


for ss in s:
    
    if ss ==")":
        if cnt>0:
            result+=ss
            cnt-=1
        else:
            result="("+result+ss

    else:
        result+=ss
        cnt+=1

L=result.count("(")
R=result.count(")")

result+=")"*(L-R)

print(result)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
ss=s
x=0
while x<len(ss)-1:
    if ss[x]=='(' and ss[x+1]==')':
        ss=ss[:x]+ss[x+2:]
        x=0
    x+=1
left=0
right=0
for i in ss:
    if i=='(':
        right+=1
    elif i==')':
        left+=1
if left>0 and right>0:
    print('('*left+s+')'*right)
elif left==0 and right>0:
    print(s+')'*right)
elif right==0 and left>0:
    print('('*left+s)
else:
    print(s)


Failing test case input:
6
()()()

Expected output:
()()()


Actual output:
(()()())


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
ss=s
x=0
while x<len(ss)-1:
    if ss[x]=='(' and ss[x+1]==')':
        ss=ss[:x]+ss[x+2:]
        x=0
    else:
        x+=1
left=0
right=0
for i in ss:
    if i=='(':
        right+=1
    elif i==')':
        left+=1
q='('*left
w=')'*right
print(q+s+w)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
S = input()

l = 0
r = 0
prev = ")"
tmp = 0
for s in S:
    if prev == ")" and s == ")":
        l += 1
    elif prev == ")" and s == "(":
        r += 1
    elif prev == "(" and s == ")":
        r -= 1
    else:
        r += 1
    prev = s
ans = "("*l + S + ")"*r
print(ans)

Failing test case input:
8
)(((())(

Expected output:
()(((())()))


Actual output:
(()(((())())))


Fixed submission (verdict: Accepted):
n = int(input())
S = input()

l = 0
r = 0
prev = ")"

for s in S:
    if prev == ")" and s == ")":
        if r > 0:
            r -= 1
        else:
            l += 1
    elif prev == ")" and s == "(":
        r += 1
    elif prev == "(" and s == ")":
        r -= 1
    elif prev == "(" and s == "(":
        r += 1
    
    prev = s
ans = "("*l + S + ")"*r

print(ans)
Problem: p03696
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def slove():
    import sys
    import copy
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    t = s
    while True:
        s = s.replace("()", "")
        if len(s) == 0:
            print(t)
            exit()
        else:
            if s[0] == ")":
                s = "".join((list("(") + list(s)))
                t = "".join((list("(") + list(t)))
            else:
                s = "".join((list(s)) + list(")"))
                t = "".join((list(t)) + list(")"))


if __name__ == '__main__':
    slove()


Failing test case input:
8
)((())))

Expected output:
(()((())))


Actual output:
((()((()))))


Fixed submission (verdict: Accepted):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    t = s
    while True:
        l_len = len(s)
        while True:
            s = s.replace("()", "")
            if len(s) == l_len:
                break
            else:
                l_len = len(s)
        if len(s) == 0:
            print(t)
            exit()
        else:
            if s[0] == ")":
                s = "".join((list("(") + list(s)))
                t = "".join((list("(") + list(t)))
            else:
                s = "".join((list(s)) + list(")"))
                t = "".join((list(t)) + list(")"))


if __name__ == '__main__':
    slove()

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n=int(input())
s=input()
ss=s
l_cnt=0
r_cnt=0
if s.count('()')>0:
    
    l_cnt=ss.count('(')
    r_cnt=ss.count(')')
    if l_cnt>r_cnt:
        s+=')'*(l_cnt-r_cnt)
    elif l_cnt==r_cnt:
        pass
        
        
    elif l_cnt<r_cnt:
        s='('*(r_cnt-l_cnt)+s
    print(s)
else:
    l_cnt=s.count('(')
    r_cnt=s.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s
    print(s)

Failing test case input:
8
))())(((

Expected output:
((())())((()))


Actual output:
))())(((


Fixed submission (verdict: Accepted):

n=int(input())
s=input()
ss=s
l_cnt=0
r_cnt=0
if s.count('()')>0:
    
    while ss.count('()')>0:
        ss=ss.replace('()','')
    l_cnt=ss.count('(')
    r_cnt=ss.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s

    print(s)
else:
    l_cnt=s.count('(')
    r_cnt=s.count(')')
    s+=')'*l_cnt
    s='('*r_cnt+s
    print(s)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()

count1 = 0
count2 = 0
flag = False

for index, s in enumerate(S):
  if s == '(':
    flag = True
    count1 += 1

  if flag and s == ')':
    count2 += 1

  if not flag:
    continue

if count1 > count2:
  S += ')' * (count1 - count2)

count1 = 0
count2 = 0
flag = False

for index, s in enumerate(S[::-1]):
  if s == ')':
    flag = True
    count1 += 1

  if flag and s == '(':
    count2 += 1

  if not flag:
    continue

if count1 > count2:
  S = '(' * (count1 - count2) + S

print(S)

Failing test case input:
6
())(()

Expected output:
(())(())


Actual output:
())(()


Fixed submission (verdict: Accepted):
N = int(input())
S = input()

count = 0
flag = False

for index, s in enumerate(S):
  if s == '(':
    flag = True
    count += 1

  if flag and s == ')' and count != 0:
    count -= 1

  if not flag:
    continue

if count > 0:
  S += ')' * count

count = 0
flag = False

for index, s in enumerate(S[::-1]):
  if s == ')':
    flag = True
    count += 1

  if flag and s == '(' and count != 0:
    count -= 1

  if not flag:
    continue

if count > 0:
  S = '(' * count + S

print(S)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
l = 0
r = 0
flag = True
for i in range(n):
  if(s[n-1-i] == '(' and flag == True):
    continue
  elif(s[n-1-i] == ')'):
    flag = False
    r += 1
  else:
    l += 1
d1 = max(0,r-l)

l = d1
r = 0

for i in range(n):
  if(s[i] == ')'):
    r += 1
  else:
    l += 1

d2 = max(0,l-r)

for i in range(d1):
  print('(',end = '')
print(s,end='')
for i in range(d2):
  print(')',end = '')
print('')

Failing test case input:
6
)))(()

Expected output:
((()))(())


Actual output:
(()))(()


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
n = len(s)
l = 0
r = 0
tmp = 0
for i in range(n):
  if(s[n-1-i] == ')'):
    tmp += 1
  else:
    tmp -= 1
    if(tmp < 0):
      tmp = 0
      r += 1
tmp = 0
for i in range(n):
  if(s[i] == '('):
    tmp += 1
  else:
    tmp -= 1
    if(tmp < 0):
      tmp = 0
      l += 1


for i in range(l):
  print('(',end = '')
print(s,end='')
for i in range(r):
  print(')',end = '')
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
K = S
left = 0
right = 0
for i in range(N):
    if S[i] == "(":
        left += 1
    elif S[i] == ")":
        right = 1

    if right == 1 and left == 0:
        K = "(" + K
        right = 0
    elif right == 1 and left > 0:
        right = 0
        left -= 1


for i in range(1,N+1):
    if S[-i] == "(":
        left = 1
    elif S[-i] == ")":
        right += 1

    if right == 0 and left == 1:
        K = K + ")"
        left = 0
    elif right == 1 and left > 0:
        right = 0
        left -= 1
print(K)


Failing test case input:
8
))(()(()

Expected output:
(())(()(()))


Actual output:
(())(()(())))


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
K = S
left = 0
right = 0
for i in range(N):
    if S[i] == "(":
        left += 1
    elif S[i] == ")":
        right = 1

    if right == 1 and left == 0:
        K = "(" + K
        right = 0
    elif right == 1 and left > 0:
        right = 0
        left -= 1

S = K
left = 0
right = 0
for i in range(1,N+1):
    if S[-i] == "(":
        left = 1
    elif S[-i] == ")":
        right += 1

    if right == 0 and left == 1:
        K = K + ")"
        left = 0
    elif right > 0 and left == 1:
        right -= 1
        left = 0
print(K)

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
left = 0
right = 0
count = 0
for i in range(len(S)):
    if(S[i] == ")"):
        count += 1
        if(i != N-1 and S[i+1] == "("):
            if(count > 0):
                left += count
            else:
                right += abs(count-1)
            count = 0
    else:
        count -= 1

if(count > 0):
    left += count
else:
    right += abs(count-1)

for i in range(left):
    S = "(" + S
for i in range(right):
    S = S + ")"
print(S)


Failing test case input:
8
()(()())

Expected output:
()(()())


Actual output:
(()(()()))))


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
left = 0
right = 0
score = 0
for i in range(len(S)):
    if(S[i] is "("):
        if(score < 0):
            left -= score
            score = 1
        else:
            score += 1
    else:
        score -= 1

if(score < 0):
    left -= score
else:
    right += score

for i in range(left):
    S = "(" + S
for i in range(right):
    S = S + ")"
print(S)
Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import deque
def main():
    n = int(input())
    s = list(input())

    stack = []
    last = []
    ans = deque([])
    for c in s:
        if c == '(':
            stack.append('(')
        else:
            if stack==[]:
                ans.appendleft('(')
                ans.append(')')
            else:
                while(stack!=[]):
                    ans.append(stack.pop())
                    last.append(')')
                last.pop()
                ans.append(')')
                
    ans.extend(stack)
    for c in stack:
        ans.append(')')
    ans.extend(last)

    for c in ans:
        print(c,end="")
    print()

if __name__ == "__main__":
    main()

Failing test case input:
8
)(())())

Expected output:
(()(())())


Actual output:
((()(())()))


Fixed submission (verdict: Accepted):
from collections import deque
def main():
    n = int(input())
    s = list(input())

    stack = []
    ans = deque([])
    for c in s:
        if c == '(':
            ans.append('(')
            stack.append('(')
        
        if c == ')':
            if stack==[]:
                ans.appendleft('(')
                ans.append(')')
            else:
                stack.pop()
                ans.append(')')
    for c in stack:
        ans.append(')')

    for c in ans:
        print(c,end="")
    print()

if __name__ == "__main__":
    main()

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input=sys.stdin.readline
import collections

def main():
    _ = int(input())
    S = input().strip()
    st = collections.deque()
    ans = ""
    for c in S:
        if c == "(":
            st.append(c)
        elif c == ")":
            if not st:
                ans = "(" + ans + ")"
            else:
                st.pop()
                ans = ans + "()"
    if st:
        ans = ans + "(" * len(st) + ")" * len(st)
    print(ans)

if __name__ == '__main__':
    main()


Failing test case input:
8
()(())))

Expected output:
((()(())))


Actual output:
((()()()))


Fixed submission (verdict: Accepted):
import sys
input=sys.stdin.readline

def main():
    _ = int(input())
    S = input().strip()
    ans = ""
    l = r = 0
    for c in S:
        if c == "(":
            r += 1
        elif c == ")":
            if r > 0:
                r -= 1
            else:
                l += 1
    ans = "("*l + S + ")"*r
    print(ans)

if __name__ == '__main__':
    main()

Problem: p03696
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()

cnt = 0
for x in input():
  if x == "(":
    cnt += 1
  else:
    cnt -= 1
    if cnt < 0:
      cnt += 1
      print("(", end="")
  print(x, end="")
print()

Failing test case input:
8
)(((()))

Expected output:
()(((())))


Actual output:
()(((()))


Fixed submission (verdict: Accepted):
N = input()

cnt = 0
s = ""
for x in input():
  if x == "(":
    cnt += 1
  else:
    cnt -= 1
    if cnt < 0:
      cnt += 1
      s = "(" + s
  s += x
for _ in range(cnt):
  s += ")"
print(s)
Problem: p03696
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = list(input())
d = []
x = 0

for i in range(len(s)):
    if s[i] == '(':
        x += 1
    else:
        x -= 1
    d.append(x)

ans = []
x = min(d)

for i in range(max(0,(-1*x))):
    ans.append('(')

for i in s:
    ans.append(i)

for i in range(max(d[len(d)-1]-x,0)):
    ans.append(')')

a = ''.join(ans)

print(a)


Failing test case input:
3
(()

Expected output:
(())


Actual output:
(()


Fixed submission (verdict: Accepted):
n = int(input())
s = list(input())
d = [0]
x = 0

for i in range(len(s)):
    if s[i] == '(':
        x += 1
    else:
        x -= 1
    d.append(x)

ans = []
x = min(d)

for i in range(max(0,(-1*x))):
    ans.append('(')

for i in s:
    ans.append(i)

for i in range(max(d[len(d)-1]-x,0)):
    ans.append(')')

a = ''.join(ans)

print(a)
Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print(input().replace(',',''))

Failing test case input:
gbjku,atcoeer.sasks

Expected output:
gbjku atcoeer.sasks


Actual output:
gbjkuatcoeer.sasks


Fixed submission (verdict: Accepted):
print(input().replace(',',' '))

Problem: p03834
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=input()
a.replace(","," ")
print(a)

Failing test case input:
akcus/fskesps,aktbf

Expected output:
akcus/fskesps aktbf


Actual output:
akcus/fskesps,aktbf


Fixed submission (verdict: Accepted):
a=input()
print(a.replace(","," "))

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
print(" ".join(input().split()))

Failing test case input:
ahp,ypnewzebr,emjoy

Expected output:
ahp ypnewzebr emjoy


Actual output:
ahp,ypnewzebr,emjoy


Fixed submission (verdict: Accepted):
print(" ".join(input().split(",")))

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

print(s.replace(", ", " "))

Failing test case input:
skcas.seeosja,tktbg

Expected output:
skcas.seeosja tktbg


Actual output:
skcas.seeosja,tktbg


Fixed submission (verdict: Accepted):
s = input()

print(s.replace(",", " "))

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
input().replace(",", " ")

Failing test case input:
dbbfddfghjh+a+deg`a

Expected output:
dbbfddfghjh+a+deg`a


Actual output:

Fixed submission (verdict: Accepted):
print(input().replace(",", " "))

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
for i in s:
  if i == ',':
    i = ' '
print(s)


Failing test case input:
fbtka,spselsf/sucka

Expected output:
fbtka spselsf/sucka


Actual output:
fbtka,spselsf/sucka


Fixed submission (verdict: Accepted):
s = input()
for i in s:
  if i == ',':
    i = ' '
  print(i,end="")

print()

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
s.replace(",", " ")
print(s)

Failing test case input:
hap,ypnewzear,enjoy

Expected output:
hap ypnewzear enjoy


Actual output:
hap,ypnewzear,enjoy


Fixed submission (verdict: Accepted):
s = input()
print(s.replace(",", " "))

Problem: p03834
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s = input().split()
print(" ".join(s))

Failing test case input:
akcur/fskdspr,aktbf

Expected output:
akcur/fskdspr aktbf


Actual output:
akcur/fskdspr,aktbf


Fixed submission (verdict: Accepted):
s = input().split(",")
print(" ".join(s))

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s = input()
ans = s.replace(",","")
print(ans)

Failing test case input:
yojme,rbezwenpy,pha

Expected output:
yojme rbezwenpy pha


Actual output:
yojmerbezwenpypha


Fixed submission (verdict: Accepted):

s = input()
ans = s.replace(","," ")
print(ans)

Problem: p03834
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input().split()
print(" ".join(s))

Failing test case input:
ahp,mpndwzecr+eziyo

Expected output:
ahp mpndwzecr+eziyo


Actual output:
ahp,mpndwzecr+eziyo


Fixed submission (verdict: Accepted):
s = input().split(",")
print(" ".join(s))