gets s=gets p r=1..$$ puts s[?#]&&r.any?{|d|t=s*1 r.all?{|i|t[i-=1]==?#?t[i+=d]==?#&&t[i]=?1:0}}?:YES:"NO"