#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void lowerword(string &s) {
for (int i = 0; i < s.size(); i++) {
s[i] = tolower(s[i]);
}
}
bool cmp(string s1, string s2) {
lowerword(s1), lowerword(s2);
return s1 < s2;
}
vector <string> words;
int main(void) {
int T;
cin >> T;
int t = 0;
while (T--) {
int n;
cin >> n;
getchar();
while (n--) {
string s;
getline(cin, s);
words.push_back(s);
}
sort(words.begin(), words.end(), cmp);
cout << "case #" << t << ":" << endl;
t++;
for (auto x : words) {
cout << x << endl;
}
words.clear();
}
return 0;
}
Linux下
gets
因为安全性问题不被建议使用;strupr
不属于c标准库,因此也不支持。