提交时间:2024-04-30 13:00:32
运行 ID: 46210
#include <bits/stdc++.h> using namespace std; int main(){ int n,sum; cin >> n; for(int i = 1;i <= n;i ++){ sum = 1; char a[25]; cin.getline(a,25); int l = strlen(a); for (int i1 = 0;i1 < l;i1 ++){ if(sum == 1 && a[i1] >= 'a' && a[i1] <= 'z'){ a[i1] -= 32; } else if(sum == 0 && a[i1] >= 'A' && a[i1] <= 'Z'){ a[i1] += 32; } sum = 0; } printf("%s\n",a); } return 0; }