**In java** public static void main(String[] args) { for(int i = 0 ,k=1; i>=0; i+=(k==1)?1:-1){ for(int c = 65, d = 1; c>=65;c+=(d==1)?1:-1){ System.out.print((char)c); d = (d!=-1 && c < 65+i)?1:-1; } k = (k!=-1 && i < 25)?1:-1; System.out.println(); } }