considering present character as the second digit of two digits no we check if the value of this key is marked in hash or not If marked then we a have a number divisible by 8
if ( visited [ mp [ str [ i ] - '0' ] ] ) { cout << " Yes " ; break ; } visited [ str [ i ] - '0' ] = true ; }