求助,样例过了,但全WA!
查看原帖
求助,样例过了,但全WA!
542389
Fcersoka楼主2023/5/9 21:37

rt

#include <bits/stdc++.h>
#define N 1001
using namespace std;
string str[N];
int cnt;
signed main()
{
	while (cin >> str[++cnt])
	{
		if ('0' <= str[cnt][0] && str[cnt][0] <= '9')
		{
			for (int i = 0; i < str[cnt].size() / 2; i++)
			{
				swap(str[cnt][i], str[cnt][i + str[cnt].size() - 1]);
			}
		}
		else
		{
			for (int i = 0; i < str[cnt].size(); i++)
			{
				if ('A' <= str[cnt][i] && str[cnt][i] <= 'Z')
				{
					str[cnt][i] += 32;
				}
				else
				{
					str[cnt][i] -= 32;
				}
			}
		}
	}
	for (int i = cnt - 1; i > 0; i--)
	{
		cout << str[i] << " ";
	}
	return 0;
}
2023/5/9 21:37
加载中...