eval a[{0..9}]=0 while read -n1 s;do a[s]+=+1;done for t in {1..9} {(((o=++a[t]>4))||($[o|=a[{1..9}]&5] for h in {1..9} {((a[h]>1))&&{ b=(${a[@]}) for((b[h]-=2,j=i=1;i<=9;b[i]>2?b[i]-=3:b[i]*b[i+1]*b[i+2]?--b[i],--b[i+1],--b[i+2]:++i,++j)){ :;} ((o*=j<14)) } } ((o))||echo $t))}