fork download
  1. def ave(ns):
  2. total = sum(ns)
  3. size = len(ns)
  4. return total / size
  5.  
  6. s = input()
  7. ns = [
  8. 1 if c == 'o' else 0
  9. for c in s
  10. ]
  11.  
  12. for i in range(len(s)-1):
  13. print(ave(ns[i:]))
  14.  
Success #stdin #stdout 0.07s 14100KB
stdin
ooxxoxx
stdout
0.42857142857142855
0.3333333333333333
0.2
0.25
0.3333333333333333
0.0