using System; using System.Linq; using System.Collections.Generic; public class yukicoder { public static void Main() { char[] input = Console.ReadLine().ToCharArray(); char temp; int ans = 0; for(int j = 0; j <= input.Length - 1; j++) { for(int i = 0; i < input.Length - 1; i++) { if(input[i] > input[i + 1]) { temp = input[i]; input[i] = input[i + 1]; input[i + 1] = temp; ans ++; } } } Console.WriteLine(ans); } }