Buggy python submission (verdict: Runtime Error):
n=int(input())
line=str(input())
line=line.replace('E','0')
line=line.replace('W','1')
line=list(map(int,line))
v=0
for i in range(n-1):
  if line[i]==0 or line[i+1]==0:
    pass
  else:
    v=line[0:i].count(o)+line[i+1:n].count(1)
    break
print(v)

Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
line=str(input())
line=line.replace('E','0')
line=line.replace('W','1')
line=list(map(int,line))
v=0
for i in range(n-1):
  if line[i]==0 or line[i+1]:
    pass
  else:
    v=line[0:i].count(o)+line[i+1:n].count(1)
    break
print(v)


Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
line=str(input())
line=line.replace('E','0')
line=line.replace('W','1')
line=list(map(int,line))
v=n
for i in range(n):
  a1=line[0:i]
  a2=line[i+1:n]
  q=a1.count(1)+a2.count(0)
  if q<v:
    v=q
print(v)


Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
line=str(input())
line=line.replace('E','0')
line=line.replace('W','1')
line=list(map(int,line))
def turn_e(x):
  count=0
  for i in range(x):
    if line[i]==1:
      count+=1
  return count
def turn_w(x):
  count=0
  for i in range(x+1,n):
    if line[i]==0:
      count+=1
  return count
v=n
for i in range(n):
  if (turn_e(i)+turn_w(i))<v:
    v=turn_e(i)+turn_w(i)
print(v)


Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
line=list(str(input()))
line.replace('E',0)
line.replace('W',1)
def turn_e(x):
  count=0
  for i in range(x):
    if line[i]==1:
      count+=1
  return count
def turn_w(x):
  count=0
  for i in range(x+1,n):
    if line[i]==0:
      count+=1
  return count
v=n
for i in range(n):
  if (turn_e(i)+turn_w(i))<v:
    v=turn_e(i)+turn_w(i)
print(v)

Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
line=list(str(input()))
def turn_e(x):
  count=0
  for i in range(x):
    if line[i]=='W':
      count+=1
  return count
def turn_w(x):
  count=0
  for i in range(x+1,n):
    if line[i]=='E':
      count+=1
  return count
v=n
for i in range(n):
  if (turn_e(i)+turn_w(i))<v:
    v=turn_e(i)+turn_w(i)
print(v)


Fixed submission:
n=int(input())
s=input()
e=s.count('E')
w=0
ans=e+w
p=0
for i in s:
  if p==1:
    w+=1
    p=0
  if i=='E':
    e-=1
  else:
    p=1
  ans=min(ans,e+w)
print(ans)