Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- namespace RegEx{
- class Program{
- public static bool Control(string data){ //Функция поиска
- if(data[0] == ' ' || data[data.Length-1] == ' '){
- return false;
- }
- Regex regex = new Regex(@"^([0-7])(T[A|B|E]X) \d{4}$");
- MatchCollection matches = regex.Matches(data);
- if (matches.Count == 1){
- return true;
- }
- return false;
- }
- static void Main(string[] args){
- int n;
- n = int.Parse(Console.ReadLine());
- string line;
- List<string> dataS = new List<string>();
- for (int i = 0; i < n; i++){
- line = Console.ReadLine();
- if (Control(line)) {
- dataS.Add(line);
- }
- }
- string str;
- long tmp = dataS.Count;
- for(int i = 0; i < dataS.Count; i++){
- str = dataS[i];
- if(str[0] != '7' && str[2] == 'E'){
- tmp--;
- } else if (str.Contains("0000")){
- tmp--;
- }
- }
- Console.WriteLine(tmp);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement