Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using System.Linq;
- namespace ConsoleApp26
- {
- class Program
- {
- static void Main(string[] args)
- {
- string simbol;
- List<string> text;
- char[] separator = { ' ', '.', ',' };
- if (args.Length > 0)
- {
- text = args[0].Split(separator).ToList();
- Console.Write("Текст: ");
- foreach (string item in text)
- {
- Console.Write(item + " ");
- }
- Console.WriteLine();
- simbol = args.Last();
- Console.WriteLine($"буква: {simbol}");
- Console.Write("Результат: ");
- foreach (string word in text)
- {
- if (word.ToLower().StartsWith(simbol))
- {
- Console.Write(word.Replace(",","").Replace(".","") + " ");
- }
- }
- }
- else
- {
- Console.WriteLine("Отсуствуют аргменты");
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment