Дата активности | Консольный раздел | Прогресс | ||
---|---|---|---|---|
2020-05-24 | book | Экзамен | % | |
2020-05-21 | book | 111. Потоки | 100 % | |
2020-05-08 | book | 110. Функции | 100 % | |
2020-04-22 | book | 101. Математика | 115 % | |
2020-04-21 | book | 100. Массивы | 100 % | |
2020-04-16 | book | 011. Циклы | 100 % | |
2020-04-08 | book | 010. Условия | 100 % | |
2020-04-06 | book | 000. Строки | 100 % | |
2020-04-06 | book | 001. Числа | 100 % | |
Итого: | 115 % |
Отличная задачка))) Пришлось посоображать... Не знаю, на сколько быстрый способ получился, но работает на "УРА")) Около 50 строк кода получилось)
Код на 50 строк получился...много - мало?) Но зато прошел со второго раза, скопировал плохо из студии)))
{
string Axy = Console.ReadLine();
string Bxy = Console.ReadLine();
string Cxy = Console.ReadLine();
int[] xyA = new int[1];
int[] xyB = new int[1];
int[] xyC = new int[1];
xyA = Array.ConvertAll((Axy.Split()), int.Parse);
xyB = Array.ConvertAll((Bxy.Split()), int.Parse);
xyC = Array.ConvertAll((Cxy.Split()), int.Parse);
double a = Geron(xyC[0], xyC[1], xyB[0], xyB[1]);
double b = Geron(xyA[0], xyA[1], xyC[0], xyC[1]);
double c = Geron(xyB[0], xyB[1], xyA[0], xyA[1]);
double p = 0.5 * (a + b + c);
double S = Math.Sqrt(p * (p - a) * (p - b) * (p - c));
Console.WriteLine("{0:0.0000}", S);
}
public static double Geron(int Ax, int Ay, int Bx, int By)
{
double L = Math.Sqrt(Math.Pow((Bx - Ax), 2)+ Math.Pow((By - Ay), 2));
return L;
}
int N = Convert.ToInt32(Console.ReadLine());
int[] R = new int[N+1];
double num = Math.Sqrt(N);
int predel = Convert.ToInt32(Math.Round(num, 0));
for (int a = 0; a < R.Length; a++)
{
R[a] = a;
}
for (int Cikly = 2; Cikly <= predel; Cikly++)
{
for (int NomerYacheiki = 2; NomerYacheiki < R.Length; NomerYacheiki++)
{ if (R[NomerYacheiki] == Cikly)
continue;
if (R[NomerYacheiki] % Cikly == 0)
R[NomerYacheiki] = 0;
}
}
for (int res = 2; res < R.Length; res++)
{
if (R[res] != 0) Console.WriteLine("R[res] = {0}", R[res]);
}
static void Main(string[] args)
{
int i = 0;
double a;
double E = double.Parse(Console.ReadLine());
while (true)
{
a = (2 / Factorial(i));
if (a <= E)
{
Console.WriteLine(i);
Console.WriteLine("{0:e6}", a);
break;
}
i++;
}
}
static double Factorial(double x)
{
if (x < 0 || x == 0) return 1;
else return (x * Factorial(x - 1));
}
string[] line = new string[] { };
line = Console.ReadLine().Split();
int temp;
int[] nums = new int[line.Length];
for (int i = 0; i < line.Length; i++)
{
nums[i] = Convert.ToInt32(line[i]);
}
if ((nums[0] < nums[1] && nums[1] < nums[2]) || (nums[1] < nums[0] && nums[2] < nums[1]))
{
if (nums[0] > nums[2])
{
temp = nums[2];
nums[2] = nums[0];
nums[0] = temp;
}
Console.WriteLine("{0} {1} {2}", nums[0], nums[1], nums[2]);
}
else Console.WriteLine("NO");
int Sum = 0;
int line = Convert.ToInt32(Console.ReadLine());
int[] digits = line.ToString().Select(c => (int)char.GetNumericValue(c)).ToArray();
for (int i = 0; i < digits.Length; i++)
{
Sum = Sum + digits[i];
}
if (Sum < 10) Console.WriteLine(Sum);
else if (Sum >= 10)
{
Z: digits = Sum.ToString().Select(c => (int)char.GetNumericValue(c)).ToArray();
Sum = 0;
for (int i = 0; i < digits.Length; i++)
{
Sum = Sum + digits[i];
}
if (Sum < 10) Console.WriteLine(Sum);
else goto Z;
}
int IndF, IndL;
string line = Console.ReadLine();
string word = Console.ReadLine() + ")";
IndF = line.IndexOf("(") + 1;
IndL = line.IndexOf(")");
line = line.Remove(IndF, (IndL-IndF+1));
line = line.Insert(IndF, word);
Console.WriteLine("{0}", line);
Stream str = Console.OpenStandardInput();
long x, min = 0;
while (true)
{
x = str.ReadByte();
if (x == -1) break; // CTRL Z
if (x > min)
{
min = x;
Console.Write(Convert.ToChar(min));
}
}
Console.WriteLine();
Stream str = Console.OpenStandardInput();
long x, Qnt = 0, count = 0;
List<long> numbers = new List<long>();
while (true)
{
x = str.ReadByte();
if (x == -1)
{
break;
}
count++;
numbers.Add(x);
}
for (int z = 0; z < numbers.Count-3; z++)
{
if (numbers[z] == 118)
{
if (numbers[z+1] == 111)
{
if (numbers[z+2] == 105)
{
if (numbers[z+3] == 100)
{
Qnt++;
}
}
}
}
}
Console.WriteLine("{0}", Qnt)
Stream str = Console.OpenStandardInput();
long x, Qnt = 0, Max = 0, count = 0;
List<long> numbers = new List<long>();
while (true)
{
x = str.ReadByte();
if (x == -1)
{
break;
}
else if (x > Max)
{
Max = x;
}
count++;
numbers.Add(x);
}
for (int z = 0; z < numbers.Count; z++)
{
if (numbers[z] == Max) { Qnt++; }
}
Console.WriteLine("{0} {1}", Max, Qnt);
Stream str = Console.OpenStandardInput();
double Min = 0, Max = 0, temp = 255;
while (true)
{
double x = str.ReadByte();
if (x == -1)
{
Console.WriteLine("{0} {1}", Min, Max);
break;
}
else if (x > Max)
{
Max = x;
}
if (x < temp)
{
Min = x;
temp = Min;
}
}
double count = 0, res = 0, temp = 0;
Stream str = Console.OpenStandardInput();
while (true)
{
int x = str.ReadByte();
if (x == 0)
{
res = 0;
break;
}
temp = temp + x;
count++;
if (x == -1)
{
res = Convert.ToDouble(temp) / count;
break;
}
}
Console.WriteLine("{0:0.000}", res);
static void Main(string[] args)
{
long a = Int64.Parse(Console.ReadLine());
long b = Int64.Parse(Console.ReadLine());
Console.WriteLine(fNOD(a, b));
}
static long fNOD(long a, long b)
{
if (a % b == 0) return b;
if (b % a == 0) return a;
if (a == b)
{
return a;
}
if (a > b)
{
long temp = a;
a = b;
b = temp;
}
return fNOD(a, b - a);
}
static void Main(string[] args)
{
string[] strA = Console.ReadLine().Split();
string[] strB = Console.ReadLine().Split();
string[] strC = Console.ReadLine().Split();
string[] strD = Console.ReadLine().Split();
string[] strE = Console.ReadLine().Split();
double[] A = Arr(strA);
double[] B = Arr(strB);
double[] C = Arr(strC);
double[] D = Arr(strD);
double[] E = Arr(strE);
Console.WriteLine("{0:N2}", sum(A, B, C, D, E));
}
public static double sum(double[] A, double[] B, double[] C, double[] D, double[] E)
{
double AC, AD, BD, BE, CE, sum = 0;
AC = Math.Sqrt((Math.Pow(C[0] - A[0], 2)) + (Math.Pow(C[1] - A[1], 2)));
AD = Math.Sqrt((Math.Pow(D[0] - A[0], 2)) + (Math.Pow(D[1] - A[1], 2)));
BD = Math.Sqrt((Math.Pow(D[0] - B[0], 2)) + (Math.Pow(D[1] - B[1], 2)));
BE = Math.Sqrt((Math.Pow(E[0] - B[0], 2)) + (Math.Pow(E[1] - B[1], 2)));
CE = Math.Sqrt((Math.Pow(E[0] - C[0], 2)) + (Math.Pow(E[1] - C[1], 2)));
sum = AC + AD + BD + BE + CE;
return sum;
}
public static double[] Arr(string[] A)
{
double[] X = new double[A.Length];
for (int i = 0; i < A.Length; i++)
{
X[i] = Convert.ToDouble(A[i]);
}
return X;
}
static void Main(string[] args)
{
string[] nums = Console.ReadLine().Split();
int[] nNew = new int[nums.Length];
for (int i = 0; i < nums.Length; i++)
{
nNew[i] = Convert.ToInt32(nums[i]);
}
Console.WriteLine(triangle(ref nNew));
}
public static int triangle(ref int[] nNew)
{
int N = 0;
for (int i = 0; i < nNew.Length - 2; i++)
{
for (int j = i + 1; j < nNew.Length - 1; j++)
{
for (int k = j + 1; k < nNew.Length; k++)
{
if ((nNew[i] > Math.Abs(nNew[j] - nNew[k])) && (nNew[i] < nNew[j] + nNew[k])) N++;
}
}
}
return N;
}
static void Main(string[] args)
{
int N = Convert.ToInt32(Console.ReadLine());
string[] nums = Console.ReadLine().Split();
int[] numsNew = new int[N];
for (int x = 0; x < nums.Length; x++)
{
numsNew[x] = Convert.ToInt32(nums[x]);
}
Console.WriteLine("{0} {1}", min(numsNew), max(numsNew));
}
public static int min(int[] a)
{
int min = a[0];
foreach (int el in a)
{
if (el < min)
{
min = el;
}
}
return min;
}
public static int max(int[] a)
{
int max = a[0];
foreach (int el in a)
{
if (el > max)
{
max = el;
}
}
return max;
}
double R = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("{0:0.0000}", (Math.PI * Math.Pow(R, 2)));
int N = Convert.ToInt32(Console.ReadLine()), min = 0, max = 0;
string[] nums = Console.ReadLine().Split();
int[] numsNew = new int[N];
for (int i = 0; i < N; i++)
{
numsNew[i] = Convert.ToInt32(nums[i]);
min = Math.Min(min, numsNew[i]);
max = Math.Max(max, numsNew[i]);
}
Console.Write("{0} {1}", min, max);
Console.WriteLine();
double[] tArr = new double[71];
double[] xArr = new double[71];
double[] yArr = new double[71];
for (int i = 0; i < 71; i++)
{
tArr[i] = 0.1d * Convert.ToDouble(i);
xArr[i] = (Math.Sin(3 * tArr[i])) + (3 * Math.Cos(tArr[i]));
yArr[i] = (Math.Cos(2 * tArr[i]));
}
Console.WriteLine("-------------------------");
Console.WriteLine("| t | x | y |");
Console.WriteLine("-------------------------");
for (int j = 0; j < 71; j++)
{
if (xArr[j] > 0 && yArr[j] > 0) Console.WriteLine("| {0:N1} | {1:N3} | {2:N3} |", tArr[j], xArr[j], yArr[j]);
if (xArr[j] > 0 && yArr[j] < 0) Console.WriteLine("| {0:N1} | {1:N3} | {2:N3} |", tArr[j], xArr[j], yArr[j]);
if (xArr[j] < 0 && yArr[j] > 0) Console.WriteLine("| {0:N1} | {1:N3} | {2:N3} |", tArr[j], xArr[j], yArr[j]);
if (xArr[j] < 0 && yArr[j] < 0) Console.WriteLine("| {0:N1} | {1:N3} | {2:N3} |", tArr[j], xArr[j], yArr[j]);
}
Console.WriteLine("-------------------------");
double y = Convert.ToSingle(Console.ReadLine());
double[] xArr = new double[] {-0.5d, -0.5d, -0.5d, -0.5d, -0.5d, -0.5d, -0.5d, -0.5d, -0.5d, -0.5d, -0.5d};
double func;
for (int i = 0; i < 11; i++)
{
xArr[i] = xArr[i] + 0.1d * i;
//Console.WriteLine(xArr[i]);
}
for (int j = 0; j < 11; j++)
{
func = (1 + Math.Pow((Math.Cos(xArr[j] + y)), 2)) / (2 + Math.Abs(y - Math.Sin(xArr[j])));
Console.WriteLine("{0:N5}", func);
}
double N = Convert.ToInt32(Console.ReadLine()), x = 0;
for (int i = 1; i <= N; i++)
{
x = Math.Sqrt(x + i);
if (i == N) Console.WriteLine("{0:N5}", x);
}
double N = Convert.ToInt32(Console.ReadLine()), num = 0;
double x = 6561;
for (int i = 1; i <= N; i++)
{
x = Math.Sqrt(x);
}
Console.WriteLine("{0:N4}", x);
double a = Convert.ToSingle(Console.ReadLine());
double x = Convert.ToSingle(Console.ReadLine());
double func = (Math.Pow(x, 0.75) + (a * x)) / (Math.Log(Math.Sqrt(a * a + Math.Sqrt(x))));
Console.WriteLine("{0:N4}", func);
string[] myArr = Console.ReadLine().Split();
int a = Convert.ToInt32(myArr[0]);
int b = Convert.ToInt32(myArr[1]);
int c = Convert.ToInt32(myArr[2]);
double x1, x2;
double D = (b * b - 4 * a * c);
if (D > 0)
{
x1 = (-b - Math.Sqrt(D)) / (2 * a);
x2 = (-b + Math.Sqrt(D)) / (2 * a);
if (x1 > x2) Console.WriteLine("{0:N3} {1:N3}", x2, x1);
else Console.WriteLine("{0:N3} {1:N3}", x1, x2);
}
if (D == 0)
{
x1 = (-b - Math.Sqrt(D)) / (2 * a);
Console.WriteLine("{0:N3}", x1);
}
if (D < 0) Console.WriteLine("NO");
int N = Convert.ToInt32(Console.ReadLine()), zero = 0;
string[] nums = Console.ReadLine().Split();
int[] numsNew = new int[N];
for (int i = 0; i < N; i++)
{
numsNew[i] = Convert.ToInt32(nums[i]);
}
foreach (int x in numsNew)
{
if (x == 0) zero++;
}
Console.WriteLine(zero);
int N = Convert.ToInt32(Console.ReadLine());
string[] nums = Console.ReadLine().Split();
int Max = 0, Min = 9, MaxIndex = 0, MinIndex = 0;
int[] numsNew = new int[N];
for (int i = 0; i < N; i++)
{
numsNew[i] = Convert.ToInt32(nums[i]);
}
for (int j = 0; j < N; j++)
{
if (numsNew[j] > Max)
{
Max = numsNew[j];
MaxIndex = j;
}
if (numsNew[j] < Min)
{
Min = numsNew[j];
MinIndex = j;
}
//Console.WriteLine("Max = {0}, MaxIndex = {1} Min = {2}, MinIndex = {3}", Max, MaxIndex, Min, MinIndex);
}
numsNew[MaxIndex] = Min;
numsNew[MinIndex] = Max;
for (int i = 0; i < N; i++)
{
Console.Write("{0} ", numsNew[i]);
}
Console.WriteLine();
int N = Convert.ToInt32(Console.ReadLine()), j = 0, min = 0, max = 0;
string[] nums = Console.ReadLine().Split();
List<int> numsNew = new List<int>();
for (int i = 0; i < N; i++)
{
numsNew.Add(Convert.ToInt32(nums[i]));
}
numsNew.Sort();
Console.WriteLine("{0} {1}", numsNew[0], numsNew[N-1]);
int num = Convert.ToInt32(Console.ReadLine());
string[] myArr = Console.ReadLine().Split();
int[] newArr = new int[myArr.Length];
for (int i = 0; i < num; i++)
{
newArr[i] = Convert.ToInt32(myArr[i]) + 1;
Console.Write("{0}", newArr[i]);
if (i < num-1)
{
Console.Write(',');
}
}
Console.Write('.');
Console.WriteLine();
int num = Convert.ToInt32(Console.ReadLine()), i = 0;
string[] myArr = Console.ReadLine().Split();
while (i < num)
{
Console.Write(myArr[num - 1 - i]+" ");
i++;
}
Console.WriteLine();
int ArrLength = Convert.ToInt32(Console.ReadLine()) - 1;
string[] MyArr = Console.ReadLine().Split();
Console.WriteLine("{0} {1}", MyArr[0], MyArr[ArrLength]);
int num = Convert.ToInt32(Console.ReadLine());
int i = 0;
int[] myArr = new int[1] { 1 };
while (i < num)
{
Console.WriteLine(myArr[0]);
i++;
}
string[] myArr = Console.ReadLine().Split();
int num = Convert.ToInt32(myArr[0]);
int stepen = Convert.ToInt32(myArr[1]);
int res = 1;
for (int i = 1; i <= stepen; i++)
{
res = res*num;
}
Console.WriteLine(res);
int x = Convert.ToInt32(Console.ReadLine());
string[] nums = Console.ReadLine().Split();
float res, sum = 0;
for (int i = 0; i < nums.Length; i++)
{
sum = sum + Convert.ToInt32(nums[i]);
}
res = sum / x;
Console.WriteLine("{0:0.0}", res);
string s = Console.ReadLine();
s = s.TrimStart('0');
Console.WriteLine(s.Length);
int num = Int32.Parse(Console.ReadLine());
int a = 0;
for (int i = 1; i < num; i++)
{
if (num == 0 || num == 1) break;
if (num % i == 0)
{
a = i;
}
}
if (a > 0)
Console.WriteLine(a);
for (int i = 1; i < 100; i++)
{
if (i % 7 != 0) continue;
Console.WriteLine(i);
}
int num = Convert.ToInt32(Console.ReadLine());
switch (num)
{
case 1:
Console.WriteLine("понедельник");
break;
case 2:
Console.WriteLine("вторник");
break;
case 3:
Console.WriteLine("среда");
break;
case 4:
Console.WriteLine("четверг");
break;
case 5:
Console.WriteLine("пятница");
break;
case 6:
Console.WriteLine("суббота");
break;
case 7:
Console.WriteLine("воскресенье");
break;
}
int num = Convert.ToInt32(Console.ReadLine());
if ((num / 100 == 0) && (num / 10 > 0) && (num % 2 == 0))
Console.WriteLine("YES");
else Console.WriteLine("NO");
Решил упороться и сделать без циклов))) Хорошая задачка)
string[] Arr = Console.ReadLine().Split();
int[] Arr1 = new int[3];
int a = Int32.Parse(Arr[0]);
int b = Int32.Parse(Arr[1]);
int c = Int32.Parse(Arr[2]);
int res1 = 0;
if (a < b && a < c)
res1 = a;
if (b < a && b < c)
res1 = b;
if (c < a && c < b)
res1 = c;
Console.WriteLine(res1); // выводим минимальное число
// проверяем на два одинаковых числа
if ((a == c) && (b == a))
{
Console.WriteLine(b);
Console.WriteLine(c);
}
if (res1 == a && a == b)
{
Console.WriteLine(b);
Console.WriteLine(c);
}
if (res1 == b && b == a)
{
Console.WriteLine(a);
Console.WriteLine(c);
}
if (res1 == c && c == a)
{
Console.WriteLine(a);
Console.WriteLine(b);
}
//Console.WriteLine("\n\n ------------1------------- \n\n");
if (a == b || a == c || a == b)
return;
if ((res1 == a) && (b < c))
{
Console.WriteLine(b);
Console.WriteLine(c);
}
if ((res1 == a) && (b > c))
{
Console.WriteLine(c);
Console.WriteLine(b);
}
//Console.WriteLine("\n\n ------------2------------- \n\n");
if ((res1 == b) && (a < c))
{
Console.WriteLine(a);
Console.WriteLine(c);
}
if ((res1 == b) && (a > c))
{
Console.WriteLine(c);
Console.WriteLine(a);
}
//Console.WriteLine("\n\n -------------3------------ \n\n");
if ((res1 == c) && (a < b))
{
Console.WriteLine(a);
Console.WriteLine(b);
}
if ((res1 == c) && (a > b))
{
Console.WriteLine(b);
Console.WriteLine(a);
}
string[] Arr = Console.ReadLine().Split();
int a = Convert.ToInt32(Arr[0]);
int b = Convert.ToInt32(Arr[1]);
int c = Convert.ToInt32(Arr[2]);
int d = Convert.ToInt32(Arr[3]);
int ab = (a - b > 0 ? (a - b) : (a - b)*(-1));
int bc = (b - c > 0 ? (b - c) : (b - c) * (-1));
int cd = (c - d > 0 ? (c - d) : (c - d) * (-1));
int da = (d - a > 0 ? (d - a) : (d - a) * (-1));
int res = 0;
if (ab > bc)
res = bc;
else res = ab;
if (res > cd)
res = cd;
if (res > da)
res = da;
Console.WriteLine(res);
string[] Arr = Console.ReadLine().Split();
int num0 = Int32.Parse(Arr[0]);
int num1 = Int32.Parse(Arr[1]);
int num2 = Int32.Parse(Arr[2]);
int num3 = Int32.Parse(Arr[3]);
int num4 = Int32.Parse(Arr[4]);
int sum = 0;
if (num0 > 0)
sum = num0;
if (num1 > 0)
sum = sum + num1;
if (num2 > 0)
sum = sum + num2;
if (num3 > 0)
sum = sum + num3;
if (num4 > 0)
sum = sum + num4;
Console.WriteLine(sum);
string[] Arr = Console.ReadLine().Split();
long num0 = long.Parse(Arr[0]);
long num1 = long.Parse(Arr[1]);
long num2 = long.Parse(Arr[2]);
if (num0 == num2 && num2 == num1)
{
Console.WriteLine("YES");
}
else
Console.WriteLine("NO");
byte num = Convert.ToByte(Console.ReadLine());
int res1 = 0, res2 = 0;
res1 = num >> 2;
res2 = num << 3;
Console.WriteLine(res1);
Console.WriteLine(res2);
int num = Int32.Parse(Console.ReadLine());
Console.WriteLine("{0} {1} {2} {3} {4}", num++, num++, num++, num++, num);
Console.WriteLine("{0} {1} {2} {3} {4}", num--, num--, num--, num--, num);
Делать было нечего, дело было вечером)))
string num = Console.ReadLine();
int len = num.Length;
int myNum = Convert.ToInt32(num);
int zero = 5 - len;
//------------------------------------------------
Console.Write(myNum);
//------------------------------------------------
Console.Write('\n');
//------------------------------------------------
int i = 0;
while (i < zero)
{
Console.Write('0');
i++;
}
Console.Write(myNum);
//------------------------------------------------
Console.Write('\n');
//------------------------------------------------
int j = 0;
while (j < zero)
{
Console.Write(' ');
j++;
}
Console.Write(myNum);
//------------------------------------------------
string text = Console.ReadLine();
string[] Arr = text.Split(new char[] { ' ' });
Console.WriteLine(Convert.ToInt32(Arr[0]) + Convert.ToInt32(Arr[1]));
Console.WriteLine(Convert.ToInt32(Arr[0]) - Convert.ToInt32(Arr[1]));
Console.WriteLine(Convert.ToInt32(Arr[0]) * Convert.ToInt32(Arr[1]));
Console.WriteLine(Convert.ToInt32(Arr[0]) / Convert.ToInt32(Arr[1]));
Console.WriteLine(Convert.ToInt32(Arr[0]) % Convert.ToInt32(Arr[1]));
Console.WriteLine("sbyte " + sbyte.MinValue + " " + sbyte.MaxValue);
Console.WriteLine("byte " + byte.MinValue + " " + byte.MaxValue);
Console.WriteLine("short " + short.MinValue + " " + short.MaxValue);
Console.WriteLine("ushort " + ushort.MinValue + " " + ushort.MaxValue);
Console.WriteLine("int " + int.MinValue + " " + int.MaxValue);
Console.WriteLine("uint " + uint.MinValue + " " + uint.MaxValue);
Console.WriteLine("long " + long.MinValue + " " + long.MaxValue);
Console.WriteLine("ulong " + ulong.MinValue + " " + ulong.MaxValue);
int x = int.Parse(Console.ReadLine());
if (x < 0)
{
x *= -1;
}
int sum, a, b, c;
a = x / 100;
c = x % 10;
b = (x - (a*100+c))/10;
//Console.WriteLine(a);
//Console.WriteLine(b);
//Console.WriteLine(c);
Console.WriteLine("{0} {1}", sum = a + b + c, x*x);
long x = Convert.ToInt64(Console.ReadLine());
long y = long.Parse(Console.ReadLine());
long z;
long.TryParse(Console.ReadLine(), out z);
Console.WriteLine("{0} {1} {2}", ++x, ++y, ++z);
string text = Console.ReadLine();
string word = Console.ReadLine();
int position = text.IndexOf(' ');
string textNew = text.Insert(position, " " + word);
Console.WriteLine(textNew);
string text = Console.ReadLine();
int startInd = text.IndexOf('(') + 1;
int endInd = text.IndexOf(')');
Console.WriteLine(text.Substring(startInd, endInd-startInd));