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

namespace AtCoder.abc120
{
  class c
  {
    static void Main(string[] args)
    {
      //0:R, 1:B
      //01 or 10 => Deleteable
      List<char> chas = Console.ReadLine().ToCharArray().ToList<char>();
      int i = 0;
      int c = 0;
      while (true)
      {
        if (i+1 == chas.Count) { Console.Write(c * 2); return; }
        if (chas[i] == chas[i + 1] + 1 || chas[i] == chas[i + 1] - 1) { chas.RemoveRange(i, 2); i = 0; c++; }
        else i++;
      }
    }
    static int GetInt() => int.Parse(Console.ReadLine());
    static int[] GetIntArray()
    {
      string[] r = Console.ReadLine().Split(' ');
      int[] a = new int[r.Length];
      Parallel.For(0, r.Length, i => a[i] = int.Parse(r[i]));
      return a;
    }
  }
}
