hiho week 259 register

Ended

Participants:95

Verdict:Accepted
Score:100 / 100
Submitted:2019-06-16 20:47:38

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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]);
            }
        }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX