i=0;print System.in.filterLine{it-~/[^DMOPW]{6}/?0:i++}