If all the digits of b contain 9 then multiply a with string length else multiply a with string length - 1
if ( i == s . length ( ) ) result = a * s . length ( ) ; else result = a * ( s . length ( ) - 1 ) ;