from math import dist S = input() x = y = 0 for c in S: match c: case 'N': y += 1 case 'E': x += 1 case 'S': y -= 1 case 'W': x -= 1 ans = dist((0, 0), (x, y)) print(ans)