On Wednesday, 2 December 2015 at 03:50:20 UTC, Charles wrote:
(..)

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

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

    writeln(floor);

Speak D to me, please.
stdin.byLine.front.map!(a => a.predSwitch('(', 1, ')', -1, 0)).sum.writeln;

Reply via email to