def min(a,b); a < b ? a : b;end S = gets.chomp c = S.index('w') puts min(c - 1, S.size - c)