Shortest Palindromic Substring | C # program to find the shortest palindromic subString ; Function return the shortest palindromic subString ; Finding the smallest character present in the String ; Driver code
using System ; class GFG { static char ShortestPalindrome ( String s ) { int n = s . Length ; char ans = s [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { ans = ( char ) Math . Min ( ans , s [ i ] ) ; } return ans ; } public static void Main ( String [ ] args ) { String s = " geeksforgeeks " ; Console . Write ( ShortestPalindrome ( s ) ) ; } }