SHARE
TWEET

Untitled

a guest Dec 16th, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. S = input()
  2. N = len(S)
  3. sum = 0
  4. count = 0
  5. flg = False
  6. S = S[::-1]
  7.  
  8. for i in range(N):
  9.   if S[i] == 'W':
  10.     count += 1
  11.     flg = True
  12.   elif S[i] == 'B' and flg:
  13.     sum += count
  14. print(sum)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top