6 kyu

WeIrD StRiNg CaSe

24,275 of 49,768xDranik

Description:

Write a function that accepts a string, and returns the same string with all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased. The indexing just explained is zero based, so the zero-ith index is even, therefore that character should be upper cased and you need to start over for each word.

The passed in string will only consist of alphabetical characters and spaces(' '). Spaces will only be present if there are multiple words. Words will be separated by a single space(' ').

Examples:

"String" => "StRiNg"
"Weird string case" => "WeIrD StRiNg CaSe"
Strings
Algorithms

Stats:

CreatedDec 22, 2013
PublishedDec 23, 2013
Warriors Trained87553
Total Skips10840
Total Code Submissions189287
Total Times Completed49768
JavaScript Completions24275
CoffeeScript Completions188
Ruby Completions3242
Haskell Completions853
Python Completions14374
C# Completions3054
PHP Completions1737
Go Completions2195
Factor Completions10
C Completions422
C++ Completions335
Lua Completions31
Total Stars780
% of votes with a positive feedback rating89% of 4353
Total "Very Satisfied" Votes3525
Total "Somewhat Satisfied" Votes705
Total "Not Satisfied" Votes123
Ad
Contributors
  • xDranik Avatar
  • jhoffner Avatar
  • bkaes Avatar
  • Unnamed Avatar
  • Chrono79 Avatar
  • brettjcohen Avatar
  • Voile Avatar
  • Souzooka Avatar
  • aradenac Avatar
  • hobovsky Avatar
  • trashy_incel Avatar
  • rabbit_binary7 Avatar
  • user8436785 Avatar
  • MikChan Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • tri@ Avatar
  • yLaWy Avatar
  • metatable Avatar
Ad