We can split at i if one of the following two is true . a ) All characters after str . charAt ( i ] are 0 b ) String after str . charAt ( i ] is divisible by b , i . e . , str . charAt ( i + 1. . n - 1 ] is divisible by b .
if ( rl [ i + 1 ] == 0 ) { System . out . println ( " YES " ) ; for ( int k = 0 ; k <= i ; k ++ ) System . out . print ( str . charAt ( k ) ) ; System . out . print ( " , ▁ " ) ; for ( int k = i + 1 ; k < len ; k ++ ) System . out . print ( str . charAt ( k ) ) ; return ; } } System . out . println ( " NO " ) ; }