using System;

public class Program
{
	public static void Main()
	{
		var S = Console.ReadLine();
		int C = S.IndexOf("w");
		int W = S.Length - C;
		Console.WriteLine(Math.Max(Math.Min(C - 1, W), 0));
	}
}