PAT A 1031 Hello World for U
作者:互联网
#include <iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
char str[100];
scanf("%s",str);
int len=strlen(str);
int n1,n2,n=0,i=1;
while(3*i<=len+2) i++;
n1=i-1;
n2=len+2-2*n1;
for(i=1;i<n1;i++,n++){
printf("%c",str[n]);
for(int j=0;j<n2-2;j++) printf(" "); //space
printf("%c\n",str[len-1-n]);
}
for(i=n;i<n1+n2-1;i++) printf("%c",str[i]);
return 0;
}
标签:std,main,include,PAT,int,str,World,1031 来源: https://blog.csdn.net/MIKET_T/article/details/104701674