import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String S = scan.next(); scan.close(); int cnt1 = 0; int cnt2 = 0; for(int i = 0; i < S.length(); i++) { char c = S.charAt(i); if(c == 'w') { cnt1 = i; cnt2 = S.length() - cnt1; break; } } if(cnt1 - 1 >= cnt2) { System.out.println(cnt2); }else { System.out.println(cnt1 - 1); } } }