Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- let isUpperCase = (c) => c === c.toUpperCase();
- let words = [];
- let currentWord = input[0];
- for(let char of input.slice(1)){
- if(!isUpperCase(char)){
- currentWord += char;
- }else{
- words.push(currentWord);
- currentWord = char
- }
- }
- console.log(words.join(', '))
- }
- solve(
- 'SplitMeIfYouCanHaHaYouCantOrYouCan'
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement