using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { var s = Console.ReadLine(); var count = MakeCww(s) .Where(x => x == "cww") .Count(); Console.WriteLine(count); } static IEnumerable MakeCww(string s) { foreach (var a in s.Select((x, i) => new { Index = i, Value = x })) { foreach (var b in s.Where((_, i) => i != a.Index).Select((x, i) => new { Index = i, Value = x }).Skip(a.Index)) { foreach (var c in s.Where((_, i) => i != a.Index && i != b.Index).Skip(b.Index)) { yield return $"{a.Value}{b.Value}{c}"; } } } } } }