Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HelloWorld
- {
- static void Main()
- {
- int p = 0;
- int index = 0;
- int n = 0;
- string tmp;
- Console.WriteLine("Введите строку :");
- string text = Console.ReadLine();
- Console.WriteLine("Количество слов в строке :");
- string[] words = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- Console.WriteLine(words.Length);
- //
- Console.WriteLine("Введите значение длинны");
- int avg = Convert.ToInt16(Console.ReadLine());
- Console.WriteLine("Слова, длинна которых превышает значение:");
- foreach (string word in words)
- {
- if (word.Length > avg)
- {
- Console.WriteLine(word);
- }
- }
- Console.WriteLine("Введите сочетание");
- string W = Console.ReadLine();
- Console.WriteLine("Сколько раз введённое сочетание встречается в каждом слове : ");
- foreach(string word in words)
- {
- while ((index = word.IndexOf(W, index) + 1) != 0) n++;
- }
- Console.WriteLine(n);
- // while ((index = a.IndexOf(b, index) + 1) != 0) count++;
- // Console.WriteLine(count);
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement