def foo (s):

	ans = 0

	count = 0

	for i in s:

		if   (not count) and (i == 'E'):pass

		elif not count: count += 1

		elif i == 'E': count -= 1; ans += 1

		else: count += 1

	return ans



n = eval(input())

s = eval(input())



print((foo(s)))
def foo (s):

    ans = 0

    count = 0

    for i in s:

        if i == 'W':

            count += 1

        elif count :

            count -= 1

            ans += 1

        else:

            pass

    return ans



n = eval(input())

s = eval(input())

 

print((foo(s)))
def foo(s):
    ans = 0
    count = 0
    for i in s:
        if (not count) and (i == "E"):
            pass
        elif not count:
            count += 1
        elif i == "E":
            count -= 1
            ans += 1
        else:
            count += 1
    return ans


n = eval(input())
s = eval(input())
print((foo(s)))

def foo(s):
    ans = 0
    count = 0
    for i in s:
        if i == "W":
            count += 1
        elif count:
            count -= 1
            ans += 1
        else:
            pass
    return ans


n = eval(input())
s = eval(input())
print((foo(s)))

-        if (not count) and (i == "E"): -            pass -        elif not count: +        if i == "W": -        elif i == "E": +        elif count: -            count += 1 +            pass