2018년 3월 30일 금요일

[C++] HackerRank CamelCase

/*
https://www.hackerrank.com/challenges/camelcase/problem


Use isupper() to check whether it's uppercase or not.


*/


#include <bits/stdc++.h>

using namespace std;

int camelcase(string s) {
    int count = 1;
    for(int i=0;i<s.length();i++) {
        if(isupper(s[i])) {
            count++;   
        }
    }
   
    return count;
}

int main() {
    string s;
    cin >> s;
    int result = camelcase(s);
    cout << result << endl;
    return 0;
}

댓글 없음:

댓글 쓰기