hiho week 259 register

Ended

Participants:95

Verdict:Accepted
Score:100 / 100
Submitted:2019-06-19 15:43:03

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<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<string> vs;
    string s;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        vs.push_back(s);
    }
    for (auto iter = vs.begin(); iter != vs.end(); ++iter) {
        for (auto sIter = iter->begin(); sIter != iter->end(); ++sIter) {
            if (*sIter == '_') {
                sIter++;
                cout << char(*sIter + 'A' - 'a');
                continue;
            }
            else if (*sIter >= 'A' && *sIter <= 'Z'){
                cout << '_';
                cout << char(*sIter -( 'A' - 'a'));
                continue;
            }
            cout << *sIter;
        }
        cout << endl;
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX