using System; namespace y { class Program { static void Main(string[] args) { char[] c = Console.ReadLine().ToCharArray(); int cnt = 0; for (int i = 0; i < c.Length - 1; i++) { for (int j = c.Length - 1; j > i; j--) { if (c[j] < c[j -1]) { char w = c[j]; c[j] = c[j -1]; c[j - 1] = w; cnt++; } } } Console.WriteLine(cnt); } } }