본문 바로가기
개발/코딩

해커랭크(HackerRank) - CamelCase / C++

by lucidmaj7 2020. 6. 30.
728x90
반응형

문제 : CamelCase 해커랭크

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

 

CamelCase | HackerRank

 

www.hackerrank.com

언어 : C++

난이도: easy

// Complete the camelcase function below.
int camelcase(string s) {
    int wordCount = 1;

   for (int i = 0; i < s.length(); i++)
    {
        if (s.at(i) >= 'A' && s.at(i) <= 'Z')
        {
            wordCount++;
        }
    }

    return wordCount;

}

 

참고

http://www.cplusplus.com/reference/string/string/at/

728x90
반응형

댓글