Binary String of given length that without a palindrome of size 3 | C # program find a binary String of given length that doesn 't contain a palindrome of size 3. ; Printing the character according to i ; Driver code
using System ; class GFG { static void generateString ( int n ) { String s = " " ; for ( int i = 0 ; i < n ; i ++ ) s += ( ( i & 2 ) > 1 ? ' b ' : ' a ' ) ; Console . WriteLine ( s ) ; } public static void Main ( String [ ] args ) { int n = 5 ; generateString ( n ) ; n = 8 ; generateString ( n ) ; n = 10 ; generateString ( n ) ; } }