Draft

Abbreviatize This!

77 of 122Cryptacular

Description:

Globalization, Internationalization, Localization, Translation... These terms are just too long to write more than once!

Many people have felt the same way and have therefore started to abbreviate terms like this:

  • Globalization => G11n
  • Internationalization => I18n
  • Localization => L10n
  • Translation => T9n

You might notice the pattern: [first letter] + [number of letters in between the first and last letter] + [last letter].

G  l o b a l i z a t i  o   n
G [1 2 3 4 5 6 7 8 9 10 11] n
G11n

We want to create a function Abbreviatize that takes a single parameter of type string, which returns the abbreviated form of the input string.

Keep in mind that we want to make a shorter version of the word, so if the word is The, there's no point in abbreviating it to T1e. In that case, we just want to return the word that was passed in.

Some examples:

Abbreviatize("Globalization") => "G11n"
Abbreviatize("Scherpenhuizen") => "S12n"
Abbreviatize("Four") => "F2r"
Abbreviatize("The") => "The"
Abbreviatize("A") => "A"
Strings

Stats:

CreatedMar 21, 2018
Warriors Trained171
Total Skips10
Total Code Submissions384
Total Times Completed122
JavaScript Completions77
Go Completions46
Total Stars0
% of votes with a positive feedback rating79% of 70
Total "Very Satisfied" Votes47
Total "Somewhat Satisfied" Votes17
Total "Not Satisfied" Votes6
Total Rank Assessments69
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Cryptacular Avatar
Ad