Update Program.cs

Fixed the non-output and started optimizing it for variable pattern lengths.