Удаление слов из предложения с помощью StringBuilder - C#
Формулировка задачи:
Нужно при помощи класса StringBuilder удалить из предложения, введенного с клавиатуры, все слова, что кончаются на "ка". Помогите пожалуйста.
Решение задачи: «Удаление слов из предложения с помощью StringBuilder»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleAppTest
{
class MainClass
{
public static void Main(string[] args) {
string[] words = Console.ReadLine().Split();
StringBuilder sb = new StringBuilder();
foreach (string str in words)
if (!str.EndsWith("ка"))
sb.AppendFormat("{0} ", str);
Console.WriteLine(sb);
}
}
}