fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5. int main() {
  6. char str[100];
  7. char a[100][100]={'\\s'};
  8. int count=0,i,j,n;
  9. scanf("%s",str);
  10. count = strlen(str);
  11. n=count;;
  12. for(i=0;i<count;i++)
  13. {
  14. a[i][i] = str[i];
  15. a[i][count-i-1]=str[i];
  16. }
  17. for(i=0;i<count;i++)
  18. {
  19. for(j=0;j<count;j++)
  20. {
  21. printf("%c ",a[i][j]);
  22. }
  23. printf("\n");
  24. }
  25. }
  26.  
Success #stdin #stdout 0s 9432KB
stdin
karpagamcollegeofengineering
stdout
k                           k 
 a                         a  
  r                       r   
   p                     p    
    a                   a     
     g                 g      
      a               a       
       m             m        
        c           c         
         o         o          
          l       l           
           l     l            
            e   e             
             g g              
             e e              
            o   o             
           f     f            
          e       e           
         n         n          
        g           g         
       i             i        
      n               n       
     e                 e      
    e                   e     
   r                     r    
  i                       i   
 n                         n  
g                           g