Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HelloWorld
- {
- static void Main()
- {
- int n = 1;
- Console.WriteLine("Введите строку :");
- string text = Console.ReadLine();
- Console.WriteLine("Количество слов в строке :");
- string[] words = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- Console.WriteLine(words.Length);
- string ex = words[0];
- for (int i = 1; i < words.Length; i++)
- {
- if (ex.Length > words[i].Length)
- {
- ex = words[i];
- n = 1;
- }
- else if (ex.Length == words[i].Length)
- {
- n += 1;
- }
- }
- Console.WriteLine("Количество слов с минимальной длинной в строке : " + n);
- Console.WriteLine("Слова,которые начинаются с буквы 'c' : ");
- foreach (string word in words)
- {
- if (word[0] == 'с')
- {
- Console.WriteLine(word);
- }
- }
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement