foreach a [read stdin] {puts [string le [regsub -all {[^0689]|(8)} $a {\1\1}]]}