my \a=[Z-] words[1..*-2,2..*];say 1+max [Z-] (-1,|grep(*!=0,:k,[Z-] a[*,1..*]),+a-1)[1..*,*]