public class Program { static void Main(string[] args) { var file = File.ReadAllLines("../../../Input.txt"); List<string> fileLog = new List<string>(file); Solve(fileLog); } static void Solve(List<string> file) { int totalScore = 0; int guideScore = 0; foreach (var line in file) { int otherInd = (int)line[0] % 32; int ind = ((int)line[2] % 32) - 23; totalScore += ind; if (ind == otherInd) { totalScore += 3; } if (ind > otherInd && (ind - otherInd) < 2) { totalScore += 6; } if (Math.Abs(ind - otherInd) == 2) { if (ind < otherInd) { totalScore += 6; } } switch (ind) { case 1: if (otherInd > 1) { guideScore += otherInd - 1; } if (otherInd == 1) { guideScore += 3; } break; case 2: guideScore += otherInd + 3; break; case 3: if (otherInd < 3) { guideScore += otherInd + 7; } if (otherInd == 3) { guideScore += 7; } break; } } //Part 1 Console.WriteLine(totalScore); //Part 2 Console.WriteLine(guideScore); } }