Check if a string contains a palindromic sub | C # program to check if there is a substring palindrome of even length . ; function to check if two consecutive same characters are present ; Driver Code
using System ; public class GFG { static bool check ( String s ) { for ( int i = 0 ; i < s . Length - 1 ; i ++ ) if ( s [ i ] == s [ i + 1 ] ) return true ; return false ; } public static void Main ( ) { String s = " xzyyz " ; if ( check ( s ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }