Construct a string of length L such that each substring of length X has exactly Y distinct letters | Java implementation to construct a string of length L such that each substring of length X has exactly Y distinct letters . ; Initialize p equal to the ASCII value of a ; Iterate till the length of the string ; Driver code
public class GFG { static void string ( int l , int x , int y ) { int p = 97 ; for ( int j = 0 ; j < l ; j ++ ) { char ans = ( char ) ( p + ( j % y ) ) ; System . out . print ( ans ) ; } } public static void main ( String [ ] args ) { int l = 6 ; int x = 5 ; int y = 3 ; string ( l , x , y ) ; } }