import std.stdio : writeln, writefln, readln; import std.range.primitives; void main() { import std.algorithm : find; string s; scan(s); if (s.find("OOO").length > s.find("XXX").length) { writeln("East"); } else if (s.find("OOO").length < s.find("XXX").length) { writeln("West"); } else { writeln("NA"); } } void scan(T...)(ref T args) { import std.stdio : readln; import std.array : split; import std.conv : to; import std.range.primitives; string[] line = readln.split; foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }