for(i in scan("stdin",""))write(nchar(gsub("[^0689]|(8)","\\1\\1",i)),"")