N = io.read("*n", "*l")
S = io.read()
x = 0
y = 0
for i = 1, N do
    if string.sub(S, i, i) == "I" then
        y = y+1
    else
        y = y-1
    end
    x = math.max(x, y)
    print(y)
end
print(x)