Advent of Code

Charles via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 1 19:50:18 PST 2015


On Tuesday, 1 December 2015 at 22:57:38 UTC, Ali Çehreli wrote:
> My visit was short due to this:
>
>  To play, please identify yourself via one of these services:
>
> [github] [google] [twitter] [reddit]
>
> Ali

I was the same way earlier, but reddit doesn't need personal 
information, so you can just make a throwaway account. Did the 
first question and it was painfully simple.

!!!! SPOILERS (stop reading here if you want to do it) !!!





     auto input = "arbitrarily long string of '(' and ')'";

     int floor;
     foreach(movement; input)
         floor += (movement == '(' ? 1 : -1);

     writeln(floor);


More information about the Digitalmars-d mailing list