On 02.12.2015 06:50, Charles wrote:
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);
If you copy the input with spaces (like I did) the code above gives
wrong result because the requirement is the input should contain only
"(" and ")".