Shortest Palindromic Substring | Function return the shortest palindromic subString ; Finding the smallest character present in the String ; Driver code
function ShortestPalindrome ( s ) { let n = s . length ; let ans = s [ 0 ] . charCodeAt ( ) ; for ( let i = 1 ; i < n ; i ++ ) { ans = Math . min ( ans , s [ i ] . charCodeAt ( ) ) ; } return String . fromCharCode ( ans ) ; } let s = " " ; document . write ( ShortestPalindrome ( s ) ) ;