fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. char s[30];
  7. char q='a';
  8. int n,k,i,j;
  9. cin >> n;
  10. for (i=0, k=n-1; i<n; i++, k--) {
  11. s[i]=q;
  12. q++;
  13. cout << 'a';
  14. for (j=0; j<k; j++) cout << " ";
  15. for (j=0; j<i+1; j++) cout << s[j];
  16. cout << "\n";
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 15232KB
stdin
26
stdout
a                         a
a                        ab
a                       abc
a                      abcd
a                     abcde
a                    abcdef
a                   abcdefg
a                  abcdefgh
a                 abcdefghi
a                abcdefghij
a               abcdefghijk
a              abcdefghijkl
a             abcdefghijklm
a            abcdefghijklmn
a           abcdefghijklmno
a          abcdefghijklmnop
a         abcdefghijklmnopq
a        abcdefghijklmnopqr
a       abcdefghijklmnopqrs
a      abcdefghijklmnopqrst
a     abcdefghijklmnopqrstu
a    abcdefghijklmnopqrstuv
a   abcdefghijklmnopqrstuvw
a  abcdefghijklmnopqrstuvwx
a abcdefghijklmnopqrstuvwxy
aabcdefghijklmnopqrstuvwxyz