using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
public class Program
{
public static void Main(string[] args)
{
var sent = Console.ReadLine().ToLower();
var sentence = CleanString(sent).Split(' ').ToList<string>();
int count = 0;
foreach (string word in sentence)
{
if (word.StartsWith("b"))
{
count += 1;
}
}
Console.WriteLine(count);
Console.Read();
}
public static string CleanString(string text)
{
var ct = new StringBuilder();
foreach (char c in text)
{
if (!char.IsPunctuation(c))
{
ct.Append(c);
}
}
var clean_text = Regex.Replace(ct.ToString(), @"\s+", " ");
return clean_text;
}
}
Объяснение:
Делает вид, что нормально работает
Популярные вопросы