Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <bits/stdc++.h>using namespace std;const int maxn = 505;int main() {// freopen("in.txt", "r", stdin);// freopen("out.txt", "w", stdout);int N;cin >> N;while(N--) {string s;cin >> s;int type = s.find('_');string ans;if(type == -1) {for(int i = 0; i < s.size(); ++i) {if(isupper(s[i])) {ans.push_back('_');s[i] = tolower(s[i]);}ans.push_back(s[i]);}}else {for(int i = 0; i < s.size(); ++i) {if(s[i] == '_') {s[i+1] = toupper(s[i+1]);continue;}ans.push_back(s[i]);}}