Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp12
- {
- class Program
- {
- static void Main()
- {
- int counter = -1;
- List<string> str = new List<string>();
- do //ввод строк
- {
- str.Add(Console.ReadLine());
- counter++;
- }
- while (str[counter]!= "");// проверка конца ввода, если пустая строка значит ввод окончен
- int t1 = 0, t2 = 0, t3 = 0, t4 = 0; // количество комментариев каждого типа
- int end_i = -1, end_j = -1;// конец комментария
- bool isComment = false; //метка комментария
- string typeOfComment = "0"; // тип комментария
- for (int i = 0; i < counter; i++)
- {
- Console.WriteLine("shag " + i);
- if (i > end_i)
- {
- for (int j = 0; j < str[i].Length; j++)
- {
- Console.WriteLine("shag stroki " + j);
- if (j > end_j)
- {
- if (!isComment)
- {
- if ((str[i][j] == '(') && (str[i][j + 1] == '*'))
- {
- isComment = true;
- typeOfComment = "1";
- }
- }
- else
- {
- if ((str[i][j] == '*') && (str[i][j + 1] == ')'))
- {
- if (typeOfComment == "1")
- {
- isComment = false;
- end_i = i; end_j = j+1;
- Console.WriteLine(end_i + " " + end_j);
- t1++;
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine(t1+" "+t2+" "+t3+" "+t4);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement