Advertisement
Guest User

Challange1

a guest
Nov 15th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4.  
  5. namespace ChrisMayor.codechallenge
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var program = new Program();
  12.             program.CountUnSecureRows();
  13.         }
  14.  
  15.         private void CountUnSecureRows()
  16.         {
  17.             var unsecureLines = ReadFile().Where(line => IsNotSecure(line)).Count();
  18.         }
  19.  
  20.         public bool IsNotSecure(string input)
  21.         {
  22.             var splitstring = input.Split(" ");
  23.             var group = splitstring.GroupBy(x => x);
  24.             return group.Any(v => v.Count() > 1);
  25.         }
  26.  
  27.         private string[] ReadFile()
  28.         {
  29.             return File.ReadAllLines(@"C:\Projekt\challange\OwR3bW9NuaZNNLtukKN5GeGPOnH2_full-words_input.txt");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement