using System;
using System.Collections.Generic;


namespace zmija
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Rec? ");
            string rec = Console.ReadLine();
            char[] niz = rec.ToCharArray();
            string[] stringNiz = null;
            Array.Resize(ref stringNiz, niz.Length);
            for (int i = 0; i < niz.Length; i++)
            {
                stringNiz[i] = new string(niz[i], 1);
            }
            List<string> list = new List<string>();

            foreach (string arrItem in stringNiz)
            {
                list.Add(arrItem);
            }
            for (int i = 0; i < list.Count; i++)
            {
                Console.Write(list[i]);
            }
            Console.WriteLine();
            int b1 = list.IndexOf("b");
            list.RemoveAt(b1);
            Console.WriteLine(b1);
            int b2 = list.IndexOf("b");
            Console.WriteLine(b2 + 1);
            b2 += 1;
            if(b2 - b1 > (list.Count + 4)/2)
            {
                Console.WriteLine(b2 - b1);

            }
            else if(b1 < (list.Count + 4) / 2 && b2 < (list.Count + 4) / 2)
            {
                Console.WriteLine((list.Count + 4) / 2 - b1);
            }
            else
            {
                Console.WriteLine(b2 - (list.Count - 2) / 2);

            }
        }
    }
}