using System; using System.Collections.Generic; class Program { static string InputPattern = "InputX"; static List GetInputList() { var WillReturn = new List(); if (InputPattern == "Input1") { WillReturn.Add("chiwachiwachiwawaparadise"); //10 } else if (InputPattern == "Input2") { WillReturn.Add("yeswecan"); //0 } else if (InputPattern == "Input3") { WillReturn.Add("cwcwcwwwcccccccccccwwwww"); //219 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List InputList = GetInputList(); string S = InputList[0]; long AnswerCnt = 0; long CntW = 0; for (int I = S.Length - 1; 0 <= I; I--) { if (S[I] == 'w') CntW++; if (S[I] == 'c') { if (CntW >= 2) { AnswerCnt += CntW * (CntW - 1) / 2; } } } Console.WriteLine(AnswerCnt); } }