Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- s = input()
- idx = 0
- right = 0
- left = 0
- total = 0
- while idx < n:
- while idx < n and s[idx] == '>':
- right += 1
- idx += 1
- while idx < n and s[idx] == '<':
- left += 1
- idx += 1
- total += right * left
- left = 0
- print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement