hiho week 259 register

Ended

Participants:95

Verdict:Accepted
Score:100 / 100
Submitted:2019-06-17 19:16:37

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;
string s;
int main() {
    int n;
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>s;
        int len=s.length();
        cout<<s[0];
        if(s.find('_')==s.npos) {
            for(int j=1; j<len; j++) {
                if(s[j]>='A' && s[j]<='Z') {
                    cout<<"_"<<char(s[j]+32);
                } else {
                    cout<<s[j];
                }
            }
        } else {
            for(int j=1; j<len; j++) {
                if(s[j]=='_') {
                    cout<<char(s[j+1]-32);
                    j++;
                } else {
                    cout<<s[j];
                }
            }
        }
        cout<<endl;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX