2013-06-05 21:47:54 +00:00
|
|
|
import std.stdio, std.algorithm, std.random, std.range;
|
2013-04-10 16:57:12 -07:00
|
|
|
|
|
|
|
|
void main() {
|
2013-06-05 21:47:54 +00:00
|
|
|
foreach (immutable i; 1 .. 9) {
|
|
|
|
|
immutable s = iota(i * 2).map!(_ => "[]"[uniform(0, 2)]).array;
|
2013-04-10 16:57:12 -07:00
|
|
|
writeln(s.balancedParens('[', ']') ? " OK: " : "bad: ", s);
|
|
|
|
|
}
|
|
|
|
|
}
|