Check if str [ 0. . i ] is palindrome using simple character by character match
for ( j = 0 ; j < i / 2 ; j ++ ) { if ( str . charAt ( j ) != str . charAt ( i - j ) ) break ; } System . out . println ( ( j == i / 2 ) ? str . charAt ( i ) + " ▁ Yes " : str . charAt ( i ) + " ▁ No " ) ; } else System . out . println ( str . charAt ( i ) + " ▁ No " ) ;