Created
December 16, 2018 13:45
-
-
Save ryupy/cd0fa12c8d26f4fed242a2b32aaffe5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| S = input() | |
| N = len(S) | |
| sum = 0 | |
| count = 0 | |
| flg = False | |
| S = S[::-1] | |
| for i in range(N): | |
| if S[i] == 'W': | |
| count += 1 | |
| flg = True | |
| elif S[i] == 'B' and flg: | |
| sum += count | |
| print(sum) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment