样例过了,得分只有20
查看原帖
样例过了,得分只有20
1413259
HYVS799楼主2024/8/13 19:47
 #include<iostream>
#include<string>
using namespace std;
int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		int a = s.size();
		bool t = false;
		for (int j = 0; j < a; j++)
		{
			
			if (((s[j] >= 65 && s[j] <= 90) || (s[j] >= 97 && s[j] <= 122)) && t == false)
			{
				if (s[j] >= 97 && s[j] <= 122)
					s[j] -= 32;
				t = true;
				cout << s[j];
				continue;
		     }
			if (t == true && (s[j] >= 65 && s[j] <= 90))
				s[j] += 32;
			cout << s[j];
		}
		cout << endl;
	}
}
2024/8/13 19:47
加载中...