f=->*a{a.product([~n=$_.to_i,-1,1,n+1]){|p,d|a|=[p]if$_[p+=d]<?.}!=a ?f[*a]:a.size}gets(p).scan(/ /){$*<<f[$`.size]}p$*.max<f[~/X/]
5 ..... .X. . . ... . . . .....
true
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!