using System using System Collections Generic using System Linq using

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
using System.Collections;
using System.IO;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
StreamReader file = new StreamReader("67.result");
string line;
line = file.ReadLine();
string s="";
string y = "Yo";
string n = "Nice";
for (int i = 0; i < line.Length-4;i++ )
{
if (i + 2 < line.Length && line.Substring(i, 2) == y)
s = s + " " + y + " ";
if (i + 4 < line.Length && line.Substring(i,+ 4) == n)
s =s+" "+ n + " ";
}
Console.WriteLine(s);
Console.ReadLine();
Console.Clear();
int k = 0, q = 0;
string[] word1 = new string[s.Length];
for (int i = 0; i < 2237; i++)
{
string[] word = s.Split(' ');
if (word[i].CompareTo(y) == 0)
k++;
if (word[i].CompareTo(n) == 0)
q++;
}
Console.WriteLine("yo={0}, nice={1}", k, q);
Console.ReadLine();
int[] yo = new int[k];
int[] nice = new int[q]; int schet = 0; int bukva = 0; int b = 0;
k = 0; q = 0;
for (int i = 0; i < 2235;i++ )
{
string[] word = s.Split(' ');
if (word[i].CompareTo(y)==0)
{
schet++;
yo[k] = schet;
}
if (word[i].CompareTo(n) == 0)
{
k++;
schet = 0;
bukva++;
}
if(word[i].CompareTo(n)==0 && word[i+2].CompareTo(n)==0)
{
nice[b] = bukva;
yo[k] = -96;
k++;
b++;
bukva = 0;
}
}
for (int i = 0; i < b; i++)
Console.WriteLine(nice[i]+" букв в слове ");
Console.WriteLine((char)(yo[0]+97));
Console.Clear();
s = "";
for (int i = 0; i < k;i++ )
{
s = s + (char)(yo[i]+96 );
}
Console.WriteLine(s);
Console.ReadLine();
}
}
}