fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. char str[] = "A C Q U A";
  5. cout<<str<<endl;
  6. for(char *ptr = str+1; *ptr != '\0'; ptr++){
  7. cout<<*ptr;
  8. cout<<string(uintptr_t(ptr - 1 - str), ' ');
  9. cout<<*ptr<<endl;
  10. }
  11.  
  12. return 0;
  13. }
Success #stdin #stdout 0s 4344KB
stdin
Standard input is empty
stdout
A C Q U A
  
C C
    
Q   Q
      
U     U
        
A       A