7 kyu

The Speed of Letters

251 of 979Yilian

Description:

Given a string as input, return a new string with each letter pushed to the right by its respective index in the alphabet.

We all know that A is a slow and Z is a fast letter. This means that Z gets shifted to the right by 25 spaces, A doesn't get shifted at all, and B gets shifted by 1 space.

You can assume the following things about your input:

  • It will only contain uppercase letters from A to Z, no whitespaces or punctuation;
  • Input strings will not exceed 100 characters (although your output string might!)

Note that if 2 or more letters fall onto the same space after shifting, the latest character will be used. For example: "BA" -> " A"

Examples

"AZ"   -->  "A                         Z"
"ABC"  -->  "A B C"
"ACE"  -->  "A  C  E"
"CBA"  -->  "  A"
"HELLOWORLD"  -->  "     E H    DLL   OLO   R  W"
Algorithms

More By Author:

Check out these other kata created by Yilian

Stats:

CreatedDec 2, 2020
PublishedDec 2, 2020
Warriors Trained2776
Total Skips50
Total Code Submissions4161
Total Times Completed979
JavaScript Completions251
C# Completions87
Python Completions333
Ruby Completions33
Java Completions150
C++ Completions101
C Completions62
Perl Completions36
Haskell Completions8
Total Stars55
% of votes with a positive feedback rating89% of 233
Total "Very Satisfied" Votes194
Total "Somewhat Satisfied" Votes29
Total "Not Satisfied" Votes10
Total Rank Assessments32
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Yilian Avatar
  • anter69 Avatar
  • Voile Avatar
  • clcraig Avatar
  • hobovsky Avatar
  • albertogcmr Avatar
  • ozichukwu Avatar
  • tobeannouncd Avatar
  • Just4FunCoder Avatar
Ad