Lexicographically all Shortest Palindromic Substrings from a given string | Function to find all lexicographically shortest palindromic substring ; Array to keep track of alphabetic characters ; Iterate to prlet all lexicographically shortest substring ; Driver Code
function shortestPalindrome ( s ) { let abcd = Array . from ( { length : 26 } , ( _ , i ) => 0 ) ; for ( let i = 0 ; i < s . length ; i ++ ) abcd [ s [ i ] . charCodeAt ( ) - 97 ] = 1 ; for ( let i = 0 ; i < 26 ; i ++ ) { if ( abcd [ i ] == 1 ) { document . write ( String . fromCharCode ( i + 97 ) + " " ) ; } } } let s = " " ; shortestPalindrome ( s . split ( ' ' ) ) ;