| 8 | import java.util.regex.*; |
| 9 | |
| 10 | public class CamelCase { |
| 11 | |
| 12 | // Complete the camelcase function below. |
| 13 | static int camelcase(String s) { |
| 14 | if(s.length() == 0 || s == null){ |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | int counter = 0; |
| 19 | for(int j=0;j<s.length();j++){ |
| 20 | if(Character.isUpperCase(s.charAt(j))){ |
| 21 | counter++; |
| 22 | } |
| 23 | } |
| 24 | if(counter == 0){ |
| 25 | return 1; |
| 26 | }else{ |
| 27 | counter = 0; |
| 28 | } |
| 29 | |
| 30 | int i=0; |
| 31 | while(!Character.isUpperCase(s.charAt(i))){ |
| 32 | i++; |
| 33 | } |
| 34 | counter++; |
| 35 | for(int j=i;j<s.length();j++){ |
| 36 | if(Character.isUpperCase(s.charAt(j))){ |
| 37 | counter++; |
| 38 | } |
| 39 | } |
| 40 | return counter; |
| 41 | |
| 42 | } |
| 43 | |
| 44 | |
| 45 | public static void main(String[] args) throws IOException { |
| 46 | Scanner input = new Scanner(System.in); |
| 47 | String s = input.nextLine(); |
| 48 | |
| 49 | System.out.println(camelcase(s)); |
| 50 | |
| 51 | |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | |
| 56 |
nothing calls this directly
no outgoing calls
no test coverage detected