using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoder345
{
    class Program
    {
        static readonly char[] CHIWAWA_WORD = new char[] { 'c', 'w', 'w' };

        static int GetChiwawaLength(string str, int sLen)
        {
            int ret = -1;
            int cnt = 0;

            for (int i = sLen; i < str.Length; i++)
            {
                if (CHIWAWA_WORD[cnt] == str[i])
                {
                    cnt++;

                    if (cnt == CHIWAWA_WORD.Length)
                    {
                        ret = (i - sLen) + 1;
                        break;
                    }
                }
            }

            return ret;
        }

        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int ans = GetChiwawaLength(s, 0);
            for (int i = 1; i < s.Length; i++)
            {
                int tmp = GetChiwawaLength(s, i);
                if ((tmp != -1) && (ans > tmp)) ans = tmp;
            }

            Console.WriteLine(ans);
        }
    }
}