Problem:
 Score : 200 points    Problem Statement You have an integer variable x .
Initially, x=0 .  Some person gave you a string S of length N , and using the string you performed the following operation N times.
In the i -th operation, you incremented the value of x by 1 if S_i= I , and decremented the value of x by 1 if S_i= D .  Find the maximum value taken by x during the operations (including before the first operation, and after the last operation).      Constraints  1≤N≤100  |S|=N  No characters except I and D occur in S .         Input The input is given from Standard Input in the following format:  N  S       Output Print the maximum value taken by x during the operations.        Sample Input 1 5
IIDID      Sample Output 1 2  After each operation, the value of x becomes 1 , 2 , 1 , 2 and 1 , respectively. Thus, the output should be 2 , the maximum value.       Sample Input 2 7
DDIDDII      Sample Output 2 0  The initial value x=0 is the maximum value taken by x , thus the output should be 0 .

Solution (Python):
a,b = int(input()),input()
j,l=0,[0]
for i in b:
	if i == "I":j+=1
	else:j-=1
	l.append(j)
print(max(l))

Solution (Python):
a,b = int(input()),input()
j,l=0,[0]
for i in b:
	if i == "I":
		j+=1
	else:
		j-=1
	l.append(j)
print(max(l))

Solution (Python):

n = int(input())
s = input()
ans = [0]

for i in s:
    if i=='I':
        ans.append(ans[-1]+1)
    else:
        ans.append(ans[-1]-1)

print(max(ans))

Solution (Python):

n = int(input())
s = input()
ans = [0]

for i in s:
    if i=='I':
        ans.append(ans[-1]+1)
    else:
        ans.append(ans[-1]-1)


print(max(ans))

Solution (Python):
n = int(input())
s = list(input())
ans = [0]
for i in s:
  if i == "I":
    ans.append(ans[-1] + 1)
  else:
    ans.append(ans[-1] - 1)
print(max(ans))

Solution (Python):


def main():
    n = int(input())
    s = input()

    x = 0
    ans = 0
    for i in range(n):
        if s[i] == 'I':
            x += 1
        elif s[i] == 'D':
            x -= 1
        ans = max(ans, x)
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
input()
current = 0
ret = 0
for x in input():
    if x == 'I':
        current+=1
    else:
        current-=1
    ret = max(ret, current)
print(ret)

Solution (Python):


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

ans = 0
temp = 0

for i in range(N):
    if S[i] == 'I':
        temp += 1
        if temp >= ans:
            ans = temp
    else:
        temp -= 1

print(ans)

Solution (Python):
from itertools import accumulate as ac
n=int(input())
s=[1 if i=="I" else -1 for i in input()]
print(max(ac([0]+s)))

Solution (Python):
N = int(input())
S = list(input())
m =0
a =[]
for i in S:
    if i =='I':
        m=m+1
        a.append(m)
    else:
        m=m-1
        a.append(m)
if max(a)>=0:
    print(max(a))
else:
    print(0)

Solution (Python):
input()
S = input()
ans = x = 0
for s in S:
  if s == 'I':x+=1
  else: x-=1
  ans = max(x,ans)
print(ans)

Solution (Python):
n=int(input())
s=input()
l=[]
for i in range(n+1):
    t=s[:i]
    l.append(t.count('I')-t.count('D'))
print(max(l))

Solution (Python):
n = int(input())
s = input()

x = 0
x_max = 0
for n_i in range(n):
    x += 1 if "I" == s[n_i] else -1
    if x_max < x:
        x_max = x
print(x_max)

Solution (Python):
n = int(input())
s = input()

x_max = 0
x = 0
for i in range(n):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1

    if x > x_max:
        x_max = x
print(x_max)

Solution (Python):
n = int(input())
s = input()
ans = 0
x = 0
for i in range(len(s)):
    if s[i] == 'I':
        x += 1
    elif s[i] == 'D':
        x -= 1
    ans = max(x, ans)
print(ans)

Solution (Python):
n=int(input())
s=list(input())

x=0
ma=0

for i in range(n):
  if s[i]=="I":
    x+=1
  else:
    x-=1
  if x>ma:
    ma=x

print(ma)

Solution (Python):
n = int(input())
s = input()

x = 0
x_max = x
for i in s:
    if i == 'I':
        x += 1
    else:
        x -= 1
    if x_max < x:
        x_max = x

print(x_max)

Solution (Python):
n=int(input())
s=input()
max=0
cnt=0
d={'I':1,'D':-1}
for c in s:
    cnt += d[c]
    if max < cnt:
        max = cnt
print(max)

Solution (Python):
n = int(input())
s = input()
x = 0
ans = 0
for ele in s:
  if ele=="I":
    x+=1
  else:
    x-=1
  ans = max(ans, x)
print(ans)

Solution (Python):
n = int(input())
s = input()
a = []
x = 0
for i in range(n):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    a.append(x)
print(max(0, max(a)))

Solution (Python):
n = input()
s = input()

li = list(s)

x = 0
num_list = list()
num_list.append(0)
for argv in li:
	if argv == "I":
		x += 1
		num_list.append(x)
	elif argv == "D":
		x -= 1
		num_list.append(x)


print(max(num_list))

Solution (Python):
def main():
    x = Max = 0
    N = int(input())
    S = input()

    for i in range(N):
        if S[i] == 'I':
            x += 1
            if x >= Max:
                Max = x
        elif S[i] == 'D':
            x -= 1
    print(Max)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
S = list(input())

s = list(S)
x = 0
res = 0
for j in range(len(s)):
    if s[j] == 'I':
        x+=1
    elif s[j] == 'D':
            x-=1
    res = max(res, x)       
print (res)

Solution (Python):
N = int(input())
S = list(input())
mx = 0
x = 0
for i in range(N):
	if S[i] == "I":
		x += 1
	else:
		x -= 1

	if x >= mx:
		mx = x

print(mx)

Solution (Python):
import numpy as np
n = int(input())
s = np.array(list(input()))
s = (s == "I") * 2 - 1
print(max(0, s.cumsum().max()))

Solution (Python):
N = int(raw_input())
S = raw_input()
x = 0
ma = 0
for s in S:
  x += 1 if s=="I" else -1
  ma = max(ma, x)
print ma

Solution (Python):
n = int(input())
s = input()

x = 0
m = 0
for o in s:
    x += (1 if o == 'I' else -1)
    m = max(x, m)
print(m)

Solution (Python):
def main():
    N = input()
    N = int(N)

    S = input()

    x = 0
    lst =[0]

    for i in S:
        if i == "I":
            x +=1
        else:
            x -=1
        lst.append(x)

    print(max(lst))

if __name__ == "__main__":
        main()

Solution (Python):
n = int(input())
S = input()

x = 0
max_x = 0
for s in S:
    if s == 'I':
        x += 1
    elif s == 'D':
        x -= 1
    max_x = max(max_x, x)
print(max_x)

Solution (Python):
N = int(input())
S = input()

ans = 0
x = 0
for i in range(N):
    if S[i] == 'I':
        x += 1
    else:
        x -= 1
    ans = max(ans, x)
print(ans)

Solution (Python):
N = int(input())
S = input()

x = 0
x_max = 0
for i in range(len(S)):
    if S[i] == 'I':
        x += 1
        x_max = max(x, x_max)
    elif S[i] == 'D':
        x -= 1
print(x_max)

Solution (Python):


n = int(input())
s = input()
x = 0
ans = 0
for i in range(len(s)):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    ans = max(ans, x)
print(ans)

Solution (Python):
N = int(input())
S = input()

cnt = 0
li = [0]
for i in range(N):
    if S[i] == "I":
        cnt += 1 
        li.append(cnt)
    else:
        cnt -= 1
        li.append(cnt)

print(max(li))

Solution (Python):
n=int(input())
s=input()
x=0
j=0
for i in range(n):
    if s[i]=='I':
        x+=1
    else:
        x-=1
    if x>j:
        j=x
print(j)

Solution (Python):


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

x = 0
max_x = 0
for i in range(N):
    if S[i] == "I":
        x += 1
    elif S[i] == "D":
        x -= 1
    max_x = max(x, max_x)
print(max_x)

Solution (Python):
N = input()
S = input()
num_list =[0]
for i in S:
    if i == "I":
        num_list.append(num_list[-1]+1)
    else:
        num_list.append(num_list[-1]-1)
    
print(max(num_list))

Solution (Python):
N = input()
S = input()
max_num = 0
current_num = 0
for i in S:
    if i == "I":
        current_num += 1
    else:
        current_num -= 1
    
    if max_num < current_num:
        max_num = current_num
    else:
        pass
    
print(max_num)

Solution (Python):
number = int(input())
string = input()

x = 0
maximum = 0

for i in string:
  if i == 'I':
    x += 1
  else:
    x -= 1

  maximum = x if x > maximum else maximum

print(maximum)

Solution (Python):
N = int(input())
S = list(input())
count = 0
max_count = 0
for i in S:
    if i == "I":
        count += 1
    if i == "D":
        count -= 1
    if max_count < count:
        max_count = count
else:
    print(max_count)

Solution (Python):
n=int(input())
s=input()
x=0
a=[x]
for i in range(n):
    if s[i]=="I":
        x=x+1
        a.append(x)
    else:
        x=x-1
        a.append(x)

print(max(a))

Solution (Python):
a=int(input())
s=input()
count=0
ans=0
for i in s:
    if i=='I':ans=ans+1
    else:ans=ans-1
    if ans>count:count=ans
print(count)

Solution (Python):
n=int(input())
x=0
a=0
for i in list(input()):
  if i=="I":
    x+=1
  else:
    x-=1
  
  a=max(a,x)
  
print(a)

Solution (Python):
N = int(raw_input())
X = list(str(raw_input()))
pre_ans = 0
ans = 0
for item in X:
    if item == "I":
        pre_ans += 1
    else:
        pre_ans -= 1
    if ans < pre_ans:
        ans = pre_ans
print ans

Solution (Python):
N=int(raw_input())
S=raw_input()
x=xmax=0
for c in S:
  if c == 'I':
    x += 1
    xmax = max(xmax, x)
  else:
    x -= 1
print xmax

Solution (Python):
input()
x=0
li=[0]
for c in input():
    x+=(c=='I')-(c=='D')
    li+=[x]
print(max(li))

Solution (Python):
N = int(input())
S = input()
rui = [0]
for s in S:
    if s == 'I':
        var = 1
    else:
        var = -1
    rui.append(rui[-1]+var)
print(max(rui))

Solution (Python):
n=int(input())
s=input()
x=ans=0
for i in range(n):
    if s[i]=='I':
        x=x+1
    elif s[i]=='D':
        x=x-1
    ans=max(ans,x)
print(ans)

Solution (Python):
n = int(input())
s = list(str(input()))
a = []
b=[]
for i in range(n + 1):
    II = int(s[:i].count('I'))
    DD = int(s[:i].count('D'))
    a.append(II - DD)
print(max(a))

Solution (Python):
n = int(input())
s = input()
I, D = [], []
for i in range(len(s)+1):
    I.append(s[0:i].count('I'))
    D.append(s[0:i].count('D'))
print(max([i - d for i, d in zip(I, D)]))

Solution (Python):
n = int(input())
s = list(input())
s = [1 if i =='I' else -1 for i in s]
l = [sum(s[:i]) for i in range(1,n+1)]
l.append(0)
print(max(l))

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()

x = 0

maxv = 0

for i in range(N):
    if S[i] == 'I':
        x += 1
        if x > maxv:
            maxv = x
    if S[i] == 'D':
        x -= 1

print(maxv)

Solution (Python):
N = int(input())
S = input()

x = [0]

for i in range(1,N+1):
    if S[i-1]=="I":
        x.append(x[i-1]+1)
    if S[i-1]=="D":
        x.append(x[i-1]-1)

print(max(x))

Solution (Python):
N,S = int(input()),input()
x = ans = 0
for c in S:
    if c == 'I':
        x += 1
    else:
        x -= 1
    ans = max(ans, x)
print(ans)

Solution (Python):
n = int(input())
s = str(input())

num = 0
res = 0

for i in range(len(s)):
  if s[i] == 'I':
    num += 1
  else:
    num -= 1
  if num > res:
    res = num

print(res)

Solution (Python):
n = int(input())
s = input()
dic = {"I": 1, "D": -1}
x = 0
num = 0
for i in s:
    x = x + dic[i]
    num = max(num, x)

print(num)

Solution (Python):
n, s = int(input()), input()

x, max_x = 0, 0
for i in range(n):
    if s[i] == "I":
        x += 1
        if x > max_x:
            max_x = x

    else:
        x -= 1

print(max_x)

Solution (Python):
N = int(input())
S = input()
Ans,t = 0,0
for s in S:
    if s == "I":
        t += 1
    else:
        t -= 1
    Ans = max(Ans,t)
print(Ans)

Solution (Python):
N = int(input())
S = input()
ans = 0
t = 0
for s in S:
    if s=="I":
        t += 1
    else:
        t -= 1
    ans = max(ans,t)
print(ans)

Solution (Python):
n = int(input())
s = list(input())
counter = 0
pre_counter = 0
big = 0

for i in range(n):
    if s[i]=="I":
        counter += 1
    else:
        counter -= 1
    big = max(big,counter)
    
print(big)

Solution (Python):
N = int(input())
S = list(input())
M = 0
x = 0
for c in S:
    if c == 'I':
        x += 1
        M = max(M, x)
    else:
        x -= 1
print(M)

Solution (Python):
n = int(input())
s = list(input())

print(max([2 * s[:i].count("I") - len(s[:i]) for i in range(n + 1)]))

Solution (Python):
N = int(input())
S = input()[:N]

D = [0]
now = 0
for s in S:
    if s=="I":now+=1
    elif s=="D":now-=1
    D.append(now)

print(max(D))

Solution (Python):
N = int(raw_input())
S = raw_input()
x = 0
maximum = 0

for i in range(0, N):
	if S[i] == 'I': x = x + 1
	else: x = x - 1
	if x > maximum: maximum = x

print maximum

Solution (Python):
n = int(input())
s = input()

ans = 0
count = 0
for i in range(n):
    if s[i] == 'I':
        count += 1
    else:
        count -= 1
    ans = max(ans,count)
print(ans)

Solution (Python):
input()
s = input()
max = 0
x = 0

for c in s:
    if c == 'I':
        x += 1
        if x>max:
            max=x
    else:
        x -= 1

print(max)

Solution (Python):
n = int(input())
s = input()
x = 0
sum = 0
for i in range(len(s)):
    if s[i] == "I":
        x += 1
    else:
        x -= 1
    sum = max(x, sum)
print(sum)

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])
s = arr_data[1][0]



x = 0

maxdata = x

for v in s:
    

    
    if v == "D":
        
        x -= 1
        
    elif v == "I":
        
        x += 1
        
    maxdata = x if maxdata<x else maxdata
    
    
print(maxdata)

Solution (Python):
x = 0
N, S = int(input()), input()
ans = 0
for i in S:
    if i == 'I':
        x += 1
        ans = max(ans, x)
    else:
        x -= 1
print(ans)

Solution (Python):
N = int(input())
S = input()

def solve():
    ans, val = 0, 0
    for S_i in S:
        if S_i == "I":
            val += 1
        else:
            val -= 1
        ans = max(ans, val)
    print(ans)
    
    
solve()

Solution (Python):

x=0
y=0
n=int(input())
F=list(input())

alist=[]
alist.append(x)
for token in F:



    if token=="I":
        x=x+1
        if x>y:
            y=x
    else:
        x=x-1
        alist.append(x)





print(y)

Solution (Python):
n=int(input())
s=input()
x=0
maxi=0
for i in range(n):
    if s[i]=="D":
        x=x-1
    elif s[i]=="I":
        x=x+1
    if maxi<x:
        maxi=x
print(maxi)

Solution (Python):
N=input()
S=list(input())
all=[]
x=0

all.append(x)
for i in S:
    if (i=="I"):
        all.append(x+1)
        x+=1
    else:
        all.append(x-1)
        x -= 1

print(max(all))

Solution (Python):
n = int(input())
a = input()
b = []
b.append(0)
sum1 = 0
for i in range(n):
    if a[i] == 'I':
        sum1+=1
        b.append(sum1)
    elif a[i] == 'D':
        sum1-=1
        b.append(sum1)
print(max(b))

Solution (Python):
input();a=[0]
for x in input():a+=[a[-1]+[1,-1][x=='D']]
print(max(a))

Solution (Python):
n = int(input())
s = input()
ans = 0
tmp = 0
for i in range(n):
    if s[i] == 'I':
        tmp += 1
    else:
        tmp -= 1
    ans = max(ans,tmp)
print(ans)

Solution (Python):





if __name__ == '__main__':
    n = int(input())
    s = input()

    x = 0
    result = 0

    for si in s:
        if si == 'I':
            x += 1
            result = max(x, result)
        elif si == 'D':
            x -= 1
            result = max(x, result)

    print(result)

Solution (Python):
_ = input()
s = input()
x, m = 0, 0
for c in s:
    if c == 'I':
        x += 1
        m = max(x, m)
    else:
        x -= 1
print(m)

Solution (Python):
N=int(input())
S=input()
x=0
y=0
for i in range(N):
  if S[i]=="I":
    x+=1
  else:
    x-=1
  if y<x:
    y=x
print(y)

Solution (Python):
n = int(input())
s = input()
num,answer = 0,0
for i in s:
	if i=="I": num += 1
	else: num -= 1
	if answer < num: answer = num
print(answer)

Solution (Python):
n = int(input())
s = input()
x = maximum = minimum = 0
for op in s:
    x = x + 1 if op == 'I' else x - 1
    maximum = max(maximum, x)
print(maximum)

Solution (Python):
_ = input()
s = input()
x, m = 0, 0
for c in s:
    if c == 'I':
        x += 1
        m = max(x, m)
    else:
        x -= 1
print(m)

Solution (Python):
N = int(input())
S = input()

R = 0
num = 0
for s in S:
    if s == 'I':
        num += 1
    else:
        num -= 1
    R = max(R, num)    
print(R)

Solution (Python):
input()
max_num = 0
count = 0
for i in list(input()):
    if 'I' == i:
        count += 1
    else:
        count -= 1
    max_num = max(max_num, count)
print(max_num)

Solution (Python):
N=int(input())
S=input()
res=0
ans=0
for i in range(len(S)):
  if S[i]=='I':
    res+=1
  else:
    res-=1
  ans=max(ans,res)
print(ans)

Solution (Python):
n=int(input())
s=input()
i=0
m=i
for c in s:
	if c == 'I':
		i+=1
	else:
		i-=1
	m=max(m,i)
print(m)

Solution (Python):
x = 0
n = int(input())
s = input()
ret = 0
for i in s:
    if i == "I":
        x += 1
    else:
        x -= 1
    ret = max(ret,x)
print(ret)

Solution (Python):
n=int(input())
s=list(input())
x=0
a=[0]
for i in range(n):
    if s[i]=="I":
        x+=1
        a.append(x)
    else:
        x-=1
        a.append(x)
a=sorted(list(set(a)))
print(a[-1])

Solution (Python):
n=int(input())
s=input()
x=0
ma=0
for i in range(n):
  if(s[i]=="D"):
    x-=1
  else:
    x+=1
    ma=max([ma,x])
print(ma)

Solution (Python):
n=int(input())
s=input()
i=0
m=i
for c in s:
	if c == 'I':
		i+=1
	else:
		i-=1
	m=max(m,i)
print(m)

Solution (Python):
N = int(input())
S = input().strip()
x = 0
ans = 0

for c in S:
  if c=='I':
    x += 1
  elif c=='D':
    x -= 1
  ans = max(ans,x)
print(ans)

Solution (Python):
N=int(input())
S=list(input())

x=0
X=[0]
for i in S:
    if i=="I":
        x+=1
    else:
        x-=1
    X.append(x)

print(max(X))

Solution (Python):
n = int(input())
a = 0
ans = [0]
lis = list(input())
for i in range(n):
    if lis[i] == "I":
        a += 1
    else:
        a-= 1
    ans.append(a)
print(max(ans))

Solution (Python):
n = int(input())
s = input()
ans = 0
cur = 0
for c in s:
    if c == 'I':
        cur += 1
        ans = max(cur, ans)
    else:
        cur -= 1

print(ans)

Solution (Python):
N=input()
S=list(raw_input())
s=[1 if i=="I" else -1 for i in S]
ans=0
t_sum=0
for i in s:
	t_sum+=i
	ans=max(ans,t_sum)
print ans

Solution (Python):
n=int(input())
s=list(str(input()))
ans=0;big=0
for i in range(n):
    if s[i]=='I':
        ans+=1
    elif s[i]=='D':
        ans-=1
    if big<ans:
        big=ans
print(big)

Solution (Python):
N = int(input())
S = input()
ans = 0
x = 0
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    ans = max(ans,x)
print(ans)

Solution (Python):
n, s = [int(input()), list(input())]
r = {0}
res = 0
for c in s:
    if c == "I":
        res += 1
    if c == "D":
        res -= 1
    r.add(res)
print(max(r))

Solution (Python):
n = int(input())
s = list(input())
x = 0
l = []
l.append(x)
for i in s:
   if i =="I":
      x += 1
   elif i =="D":
      x -= 1
   l.append(x)
print(max(l))

Solution (Python):


x = 0
input()
s = input()

mx = 0
for c in s:
    if c == 'I':
        x += 1
    if c == 'D':
        x -= 1
    mx = max(mx, x)
print(mx)

Solution (Python):
def main():
    N = int(input())
    S = input()

    x = 0
    ans = 0
    for c in S:
        if c == "I":
            x += 1
        else:
            x -= 1
        ans = max(ans, x)

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
inputted = int(raw_input())
l = list(raw_input())
x = 0
record = []
record.append(x)
for i in range(len(l)):
    if l[i] == "I":
        x+=1

    elif l[i] == "D":
        x-=1
    record.append(x)
print max(record)

Solution (Python):
n=int(input())
s=list(input())
array=[]
array=[0]*(n+1)
if s[0]=="I":
    array[0]=1
else:
    s[0]=-1
for i in range(1,n):
    if s[i]=="I":
        array[i]=array[i-1]+1
    else:
        array[i]=array[i-1]-1
print(max(array))

Solution (Python):
input()
s=input()
while s.find('DI') >-1:
    s=s.replace('DI','')
print(len(s.strip('D')))

Solution (Python):
N = int(input())

S = input()

x = 0

Ans = [0]

for i in range(N):
	if S[i] == "I":
		Ans.append(Ans[i] + 1)
	if S[i] == "D":
		Ans.append(Ans[i] - 1)

print(max(Ans))

Solution (Python):
num = int(input())
val = input()
max = 0
res = 0
for i in list(val):
    if i == "I":
        res += 1
    else:
        res -= 1
    if res > max:
        max = res
print(max)

Solution (Python):
def main():
    N = int(input())
    S = list(input())
    
    R = [0]
    x = 0
    for s in S:
        if s == "I":
            x += 1
        else:
            x -= 1
        R.append(x)
    R.sort()
    print(R[-1])


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
s = input()
max = 0
temp = 0
for i in range(n):
  if s[i] == "I":
    temp += 1
    if temp > max:
      max = temp
  elif s[i] == "D":
    temp -= 1

print(max)

Solution (Python):
n = int(input())
s = input()
ans = [0]
for i in range(n):
    if s[i] == 'I':
        ans.append(ans[-1] + 1)
    else:
        ans.append(ans[-1] - 1)
print(max(ans))

Solution (Python):
d = {"I": 1, "D": -1}
x = 0
N = int(input())
S = input()
ans = 0
for Si in S:
    x += d[Si]
    ans = max(ans, x)
print(ans)

Solution (Python):
userInp = int(input())


inpStr = input()
inpStrs = list(inpStr)
count = 0;
maximum = 0;

for x in range(0,userInp):
	if inpStrs[x] == "I":
		count+= 1
		if maximum <= count:
			maximum = count

	elif inpStrs[x] == "D":
		count -= 1


print(maximum)

Solution (Python):
def main():
    n = int(input())
    s = input()

    x, maxv = 0, 0
    for c in s:
        if c == 'I':
            x += 1
        elif c == 'D':
            x -= 1
        if x > maxv:
            maxv = x
    print(maxv)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
s=input()
x=0
maxx=0
for char in s:
  if char =='I':
    x+=1
  else:
    x-=1
  if maxx<x:
    maxx=x
print (maxx)

Solution (Python):
N = int(input().strip())
S = input().strip()
x = 0
maxOfx = 0
'''
if(not len(S) == N):
    print('String length match the given value of N')
    exit()
else:
    for i in range(N):
        if not (S[i] is 'I' or S[i] is 'D'):
            print('The character at %d is not I or D'%(i+1))
            exit()
'''
for i in S:
    if i is 'I':
        x+=1
        if x > maxOfx:
            maxOfx = x
    else:
        x-=1
        if x > maxOfx:
            maxOfx = x
print(maxOfx)

Solution (Python):
n = int(input())
s = input()
x = 0
ans = 0

for i in range(n):
    if s[i] == 'I':
        x += 1
        ans = max(ans, x)
    else:
        x -= 1

print(ans)

Solution (Python):
N=int(input())
S=input()
ans=0
x=0
for i in range (N):
 if (S[i]=='I'):
  x+=1
 else:
  x-=1
 ans=max(ans,x)
print(ans)

Solution (Python):
N = int(input())
S = input()
ans = 0
num = 0
for i in range(N):
    if S[i] == 'I':
        num += 1
    else:
        num -= 1
    ans = max(ans,num)
print(ans)

Solution (Python):
N = int(input())
S = input()
x = 0
ret = 0
for s in S:
    x += 1 if s == 'I' else -1
    ret = max(ret, x)
print(ret)

Solution (Python):
n = int(input())
s = input()
tmp = 0
ans = 0

for i in range(n):
    if s[i] == "I":
        tmp += 1
    else:
        tmp -= 1
    if ans < tmp:
        ans = tmp
print(ans)

Solution (Python):
N = int(input())
S = input()
array = [0]
cnt = 0
for w in S:
    if w == "I":
        cnt += 1
        array.append(cnt)
    else:
        cnt -= 1
        array.append(cnt)
print(max(array))

Solution (Python):
N = int(input())
S = input()
x = 0
ans = 0
for i in range(N):
    if S[i] == 'I':
        x += 1
        ans = max(ans, x)
    elif S[i] == 'D':
        x -= 1
print(ans)

Solution (Python):
from collections import Counter
input()
mymax=0
s=0
for i in input():
    if i =='I':
        s+=1
        mymax=max(mymax,s)
    if i=='D':
        s-=1
print(mymax)

Solution (Python):
n=int(input())
s=input()
ans=[0]
x=0
for i in s:
    if i =="I":
        x+=1
    else:
        x-=1
    ans.append(x)
print(max(ans))

Solution (Python):
N=int(input())
S=input()

x=0

X=[0]

for i in range(N):
    if S[i]=='I':
        x=x+1
        X.append(x)
        
    elif S[i]=='D':
        x=x-1
        X.append(x)

print(max(X))

Solution (Python):





def main():
    N = int(input())
    S = input()

    x = xmax = 0
    for c in S:
        if c == "I":
            x += 1
            if x > xmax:
                xmax = x
        elif c == "D":
            x -= 1

    print(xmax)

if __name__ == "__main__": main()

Solution (Python):
n = int(input())
s = list(input())
x = 0
ans = 0
for i in range(n):
    if s[i]=="I":
        x += 1
        if x > ans:
            ans = x
    else:
        x -= 1
print(ans)

Solution (Python):
N = int(input())
S = str(input())

x = [0] * N

for i in range(N):
    if S[i] == "I":
        x[i] = x[i-1] + 1
    else:
        x[i] = x[i-1] - 1

if max(x) > 0:
    print(max(x))
else:
    print(0)

Solution (Python):
n = int(input())

s = list(map(str, input()))
count = 0
smax = 0

for i in range(len(s)):
    if s[i] == "I":
        count += 1
        if count > 0 and count > smax:
            smax += 1
    else:
        count -= 1
print(smax)

Solution (Python):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

N = ri()
S = rls()
ans = 0
num = 0
for i in S:
    num += 1 if i == "I" else -1
    ans = max(ans, num)
print(ans)

Solution (Python):
from collections import defaultdict


def main():
    N = int(input())
    S = input()
    x = 0
    ans = 0
    for s in S:
        if s == "I":
            x += 1
        else:
            x -= 1
        ans = max(ans, x)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = input()
s = raw_input()

p = 0
tmp = 0

for i in range(len(s)):
    if s[i] == 'I':
        tmp += 1
        if p < tmp:
            p = tmp
    else:
        tmp -= 1

print p

Solution (Python):
N = int(input())
S = str(input())

v = 0
record = 0
for k in S:
  if (k == 'I'):
    record += 1
  else:
    record -= 1
  v = max(v, record)

print(v)

Solution (Python):
import sys




def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    s = read_str()
    x = 0
    res = 0
    for l in s:
        if l == 'I':
            x += 1
        else:
            x -= 1
        if x > res:
            res = x
    print(res)


main()

Solution (Python):

 
import sys
import subprocess
import json
import time
import math
import re
import sqlite3
 
N = int(input())
s = input()
x = 0
max_x = 0
 
for c in s:
    if c == 'I': x += 1
    else: x -= 1
    max_x = max(max_x, x)
 
print(max_x)

Solution (Python):


import sys
import subprocess
import json
import time
import math
import re
import sqlite3

N = int(input())
s = input()
x = 0
max_x = 0

for c in s:
    if c == 'I': x += 1
    else: x -= 1
    max_x = max(max_x, x)

print(max_x)

Solution (Python):
s = input()
s = input()
cnt = 0
ans = 0
for c in s:
  if c == 'I':
    cnt += 1
  else:
    cnt -= 1
  ans = max(ans, cnt)
print(ans)

Solution (Python):
N = int(input())
S = input()

x = 0
x_max = 0

for i in S:
    if i == "I":
        x += 1
    else:
        x -= 1
    if x > x_max:
        x_max = x

print(x_max)

Solution (Python):
N = int(input())
S = input()

x = 0
x_max = 0

for s in S:
    if s == "I":
        x += 1
    else:
        x -= 1
    if x > x_max:
        x_max = x

print(x_max)

Solution (Python):
n = int(input())
s = input()
x = 0
max = 0
for i in s:
    if i == "I":
        x += 1
        if x > max:
            max = x
    else:
        x -= 1

        
print(max)

Solution (Python):
N = input()
S = raw_input()
x = 0
maxx = 0
for c in S:
  if c == 'I':
    x += 1
  else:
    x -= 1
  if(x > maxx):
    maxx = x
print maxx

Solution (Python):
N = int(input())

S = [i for i in input()]

tmp = 0
m = 0

for i in range(N):
    if S[i] == 'I':
        tmp += 1
    else:
        tmp -= 1

    if tmp > m:
        m = tmp

print(m)

Solution (Python):
n = int(input())
s = input()

x = 0
ans = 0
for i in range(n):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    if ans < x:
        ans = x
print(ans)

Solution (Python):
n = int(input())
s = input()
ma = 0
v = 0
for i in range(n):
    if s[i] == 'I':
        v += 1
    else:
        v -= 1
    ma = max(ma, v)
print(ma)

Solution (Python):
N = int(raw_input())
S = raw_input()
ans, x = 0, 0
for ch in S:
    if ch == 'I':
        x += 1
    elif ch == 'D':
        x -= 1
    ans = max(ans, x)
print ans

Solution (Python):
N=int(input())
S=str(input())
t=[0]
s=0
for i in range(N):
  if S[i]=="I":
    s+=1
  else:
    s-=1
  t+=[s]
ans=0
for i in range(N+1):
  ans=max(ans,int(t[i]))
print(ans)

Solution (Python):
state = [0]
n     = int(input())
chars = list(input())
for c in chars:
  if c == "D":
    a = state[-1]
    a -= 1
  else:
    a = state[-1]
    a += 1
  state.append(a)
print(max(state))

Solution (Python):



N = int(raw_input())
S = raw_input()
x = 0
y = [x]
for i in range(N):
    if S[i] == 'I':
        x += 1
    elif S[i] == 'D':
        x -= 1
    y.append(x)
print max(y)

Solution (Python):
import numpy as np

n = int(input())

s = np.zeros(n)
s = input()

x = 0
x1 = 0

for i in range(n):
    if s[i] == 'I':
        x1 += 1
        if x1 > x:
            x = x1
    else:
        x1 -= 1

print(x)

Solution (Python):
N = int(input())
S = input()
x = 0
y = 0
for i in range (N):
    if  S[i]=='I':
        x=x+1
        if y<x:
            y=x
    else:
        x=x-1
print(y)

Solution (Python):
length = int(input())
values = input()
continued_l = len(values)
x = 0
max_x = 0
for c in values:
    if c == 'I':
        x += 1
    elif c == 'D':
        x -= 1
    if x > max_x:
        max_x = x
print(max_x)

Solution (Python):
N=int(input())
S = input()


X=0
X_max=0

for i in range(N):
    
    if S[i]=="I":
        X=X+1
       
        if X>X_max:
            X_max=X
    else:
        X=X-1

print(X_max)

Solution (Python):
n = int(input())
s = input()
ans = [0]
for i,c in enumerate(s):
    if c == 'I':
        ans.append(ans[i] + 1)
    else:
        ans.append(ans[i] - 1)
print(max(ans))

Solution (Python):
n = int(input())
s = input()
x = 0
max = 0
for i in range(n):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    if x > max:
        max = x

print(max)

Solution (Python):
n = int(raw_input())
s = raw_input()
mx = 0
cnt = 0
for c in s:
    if c == 'I':
        cnt += 1
    else:
        cnt -= 1
    mx = max(mx, cnt)
print mx

Solution (Python):
N = int(input())
S = list(input())

cnt = 0
li = [0]

for i in range(N):
    if S[i] is 'I':
        cnt += 1
    else:
        cnt -= 1
    li.append(cnt)

print(max(li))

Solution (Python):

N = int(raw_input())
S = raw_input()
ans = cur = 0
for s in S:
    if s == "I":
        cur += 1
    else:
        cur -= 1
    ans = max(ans, cur)
print ans

Solution (Python):
n = int(input())
s = input()
x = 0
max = 0
for i in range(n):
    if (s[i] == 'I'):
        x += 1
    elif (s[i] == 'D'):
        x -= 1

    if (max < x):
        max = x


print("%d" % max)