We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */Scannerinput=newScanner(System.in);while(input.hasNextLine()){Stringnext=input.nextLine();charoperation=next.charAt(0);chartype=next.charAt(2);Stringitem=next.substring(4);if(operation=='S'){Stringresult=newString();for(chari:item.toCharArray()){if(type=='M'&&i=='('){break;}if(result.isEmpty()==false&&Character.isUpperCase(i)){result+=' ';}result+=Character.toLowerCase(i);}System.out.println(result);}if(operation=='C'){Stringresult=newString();intflag=0;for(chari:item.toCharArray()){if(result.isEmpty()){if(type=='C'){result+=Character.toUpperCase(i);continue;}}if(flag!=1&&i!=' '){result+=i;}if(flag==1){result+=Character.toUpperCase(i);flag=0;}if(i==' '){flag=1;continue;}}if(type=='M'){result+="()";}System.out.println(result);}}}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Camel Case 4
You are viewing a single comment's thread. Return to all comments →