using System; using System.IO; class Hello { static void Main(string[] args) { using(StreamReader file = new StreamReader("../data/2015/1/input.txt")) { Int32 c; int floor = 0; do { c = file.Read(); if ((char)c == '(') floor++; else if((char)c == ')') floor--; } while (c != -1); Console.WriteLine("Part 1: " + floor); } using(StreamReader file = new StreamReader("../data/2015/1/input.txt")) { Int32 c; int steps = 0; int floor = 0; do { c = file.Read(); if ((char)c == '(') floor++; else if((char)c == ')') floor--; steps++; if (floor < 0) break; } while (c != -1); Console.WriteLine("Part 2: " + steps); } } }