Generate a String of having N * N distinct non | Java Program to implement the above approach ; Function to construct a string having N * N non - palindromic substrings ; Driver Code
class GFG { static void createString ( int N ) { for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( ' a ' ) ; } for ( int i = 0 ; i < N ; i ++ ) { System . out . print ( ' b ' ) ; } } public static void main ( String [ ] args ) { int N = 4 ; createString ( N ) ; } }