Hackerrank solution Camelcase of Strings in Java simple 1 line code - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Saturday, May 6, 2017

Hackerrank solution Camelcase of Strings in Java simple 1 line code

Hackerrank solution Camelcase of Strings in Java simple 1 line code | Algorithm



HackerRank Online Judge Solution  | Algorithm
HackerRank Main Problem Link - https://www.hackerrank.com/challenges/camelcase

Problem Name: HackerRank Problem
Problem Number : HackerRank Problem Camelcase Solution
Online Judge : HackerRank Online Judge Solution
Category: Algorithm
Solution Language : java

Hackerrank solution Camelcase of Strings in Java simple 1 line code

HackerRank Solution Camelcase Code in Java:

import java.util.Scanner;

public class Solution {


 public static void main(String[] args) {
  Scanner input = new Scanner(System.in);
        
  String s = input.next();
  int totalWord = s.length() - s.replaceAll("[A-Z]", "").length() + 1;
        
  System.out.println(totalWord);
 }

}

No comments:

Post a Comment