Number of strings of length N with no palindromic sub string | Return the count of strings with no palindromic substring . ; Driver Code
function numofstring ( n , m ) { if ( n == 1 ) return m ; if ( n == 2 ) return m * ( m - 1 ) ; return m * ( m - 1 ) * Math . pow ( m - 2 , n - 2 ) ; } let n = 2 , m = 3 ; document . write ( numofstring ( n , m ) ) ;