Created
December 3, 2018 03:45
-
-
Save mfrazi/26903edb0029bc9600873c333d7ab8c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
#include<string.h> | |
int main(){char t[100];scanf("%s",t);int l=strlen(t),x=l*3-3,y=l-1;for(int i=-y;i<=y;i++,printf("\n"))for(int j=x;j>=-x;j--){int m=abs(i+j),n=abs(i-j);printf("%c",(!m||m==(l-1)*3||!n||n==(l-1)*3||abs(i)==y&&(abs(j)>=l&&abs(j)<=(l-1)*2))?(abs(j)>=l*2-1?t[abs(m-n)/2]:t[abs(l-1-abs(j))]):' ');}return 0;} | |
/* | |
Input | |
programming | |
Output | |
gnimmargorp programming | |
n r r n | |
i o o i | |
m g g m | |
m r r m | |
a a a a | |
r m m r | |
g m m g | |
o i i o | |
r n n r | |
p g p | |
r n n r | |
o i i o | |
g m m g | |
r m m r | |
a a a a | |
m r r m | |
m g g m | |
i o o i | |
n r r n | |
gnimmargorp programming | |
------------------------------------------------------------ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment