#include <iostream> #include <fstream> #include <string> #include <vector> #include <algorithm> #include <iomanip> #include <cstring> #include <cmath> using namespace std; string format(const string& s) { string s0; if (s[0] < 'a' || s[0]>'z')s0 = s[0]; else s0 = s[0] + 'A' - 'a'; for (int i = 1; i < s.length(); i++) { if (s[i] < 'A' || s[i]>'Z')s0 += s[i]; else s0 += s[i] - 'A' + 'a'; } return s0; } int main() { int i, n; string s; cin >> n; for (i = 0; i < n; i++) { cin >> s; cout << format(s) << endl; } return 0; }
NOI / 1.7编程基础之字符串 15:整理药名
最新推荐文章于 2023-05-15 21:25:39 发布