$a=<>;@4=grep{$c+=($b=$a=~s/$_//g)>3?6:!$b;$b%3}1..9;print@$c." @$c "