## Saturday, November 5, 2016

### Hacker Rank - CamelCase

Problem:

Please find the problem here.

Solution:

A capital letter indicates a word, the first word starts with lower case so 1 more word. The only case we need to be careful is that of empty string.

Code:

#include "stdafx.h"

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

#include <string>
#include <iostream>

using namespace std;

int HACKER_RANK_CAMEL_CASE()
{
string s;
cin >> s;
int c = 0;
if (s.length() > 0)
{
c++;
}
for (size_t i = 0; i < s.length(); i++)
{
if ('A' <= s[i] && s[i] <= 'Z')
{
c++;
}
}
cout << c;
return 0;
}

#### 1 comment :

1. Hello guys this solution is correct but if you want to learn more and then I suggest one site where you can learn too and find this hackerrank problem solution and other hackerrank problem solution too.the link is given below
https://coderinme.com/camelcase-hackerrank-problem-solution/?utm-tracker=andrewalgorithm