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.
It is show the answer ,as it expected but still smae issue "wrong answer"
functionprocessInput(input){const[operation,type,words]=input.split(";");if(operation==="S"){// SPLIT operation: Insert spaces before uppercase letters, remove "()" for methodsletresult=words.replace(/\(\)$/,'')// Remove () for methods.replace(/([A-Z])/g,'$1')// Insert space before uppercase.toLowerCase().trim();console.log(result);}elseif(operation==="C"){// COMBINE operation: Convert to CamelCaseletwordsArray=words.split(" ");letresult=wordsArray.map((word,index)=>index===0&&type!=="C"?word.toLowerCase()// First word lowercase (except Class):word.charAt(0).toUpperCase()+word.slice(1).toLowerCase()// Capitalize others).join('');if(type==="M")result+="()";// Append () for methodsconsole.log(result);}}
Wrong Answer
Input (stdin)
S;V;iPad
C;M;mouse pad
C;C;code swarm
S;C;OrangeHighlighter
Your Output (stdout)
i pad
mousePad
()
CodeSwarm
orange highlighter
Expected Output
i pad
mousePad()
CodeSwarm
orange highlighter
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 →
It is show the answer ,as it expected but still smae issue "wrong answer"
Wrong Answer Input (stdin) S;V;iPad C;M;mouse pad C;C;code swarm S;C;OrangeHighlighter Your Output (stdout) i pad mousePad () CodeSwarm orange highlighter Expected Output i pad mousePad() CodeSwarm orange highlighter