6 kyu

Case Reversal of Consecutive Duplicates

391 of 734glenoakes

Description:

The aim of this Kata is to write a function which will reverse the case of all consecutive duplicate letters in a string. That is, any letters that occur one after the other and are identical.

If the duplicate letters are lowercase then they must be set to uppercase, and if they are uppercase then they need to be changed to lowercase.

Examples:

reverseCase("puzzles")    Expected Result: "puZZles"
reverseCase("massive")    Expected Result: "maSSive"
reverseCase("LITTLE")     Expected Result: "LIttLE"
reverseCase("shhh")       Expected Result: "sHHH"
reverse_case("puzzles")    Expected Result: "puZZles"
reverse_case("massive")    Expected Result: "maSSive"
reverse_case("LITTLE")     Expected Result: "LIttLE"
reverse_case("shhh")       Expected Result: "sHHH"
reverse_case("puzzles")    Expected Result: "puZZles"
reverse_case("massive")    Expected Result: "maSSive"
reverse_case("LITTLE")     Expected Result: "LIttLE"
reverse_case("shhh")       Expected Result: "sHHH"
reverse_case("puzzles")    Expected Result: "puZZles"
reverse_case("massive")    Expected Result: "maSSive"
reverse_case("LITTLE")     Expected Result: "LIttLE"
reverse_case("shhh")       Expected Result: "sHHH"

Arguments passed will include only alphabetical letters A–Z or a–z.

Fundamentals

More By Author:

Check out these other kata created by glenoakes

Stats:

CreatedJul 5, 2016
PublishedAug 3, 2016
Warriors Trained1308
Total Skips69
Total Code Submissions3096
Total Times Completed734
JavaScript Completions391
Python Completions291
Ruby Completions84
Crystal Completions7
Total Stars29
% of votes with a positive feedback rating93% of 226
Total "Very Satisfied" Votes197
Total "Somewhat Satisfied" Votes27
Total "Not Satisfied" Votes2
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • glenoakes Avatar
  • GiacomoSorbi Avatar
  • smile67 Avatar
  • adrian.eyre Avatar
  • saudiGuy Avatar
Ad