1031

版权声明:// Copyright © 2018年 Coding18. All rights reserved. https://blog.csdn.net/Coding18/article/details/86183451
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
	char s[100];
	scanf("%s",s);
	int x,y;
	int len = strlen(s);
	for(y = (len-1)/2; y >= 0; y--)
	{
		x = len + 2 - 2 * y;
		if(y <= x) break;
	}
	for(int i = 0; i < y-1; i++)
	{
		printf("%c",s[i]);
		for(int j = 0; j < x - 2; j++) printf(" ");
		printf("%c\n",s[len-1-i]);
	}
	for(int i = y-1; i <= x+ y -2; i++)
	printf("%c",s[i]);
	
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/Coding18/article/details/86183451
今日推荐