5 kyu

Typoglycemia Generator

240 of 847trip

Description:

Background
There is a message that is circulating via public media that claims a reader can easily read a message where the inner letters of each words is scrambled, as long as the first and last letters remain the same and the word contains all the letters.

Another example shows that it is quite difficult to read the text where all the letters are reversed rather than scrambled.

In this kata we will make a generator that generates text in a similar pattern, but instead of scrambled or reversed, ours will be sorted alphabetically

Requirement
return a string where:

  1. the first and last characters remain in original place for each word
  2. characters between the first and last characters must be sorted alphabetically
  3. punctuation should remain at the same place as it started, for example: shan't -> sahn't

Assumptions

  1. words are seperated by single spaces
  2. only spaces separate words, special characters do not, for example: tik-tak -> tai-ktk
  3. special characters do not take the position of the non special characters, for example: -dcba -> -dbca
  4. for this kata puctuation is limited to 4 characters: hyphen(-), apostrophe('), comma(,) and period(.)
  5. ignore capitalisation

for reference: http://en.wikipedia.org/wiki/Typoglycemia

Fundamentals

Similar Kata:

Stats:

CreatedJul 2, 2015
PublishedJul 2, 2015
Warriors Trained2622
Total Skips532
Total Code Submissions6048
Total Times Completed847
JavaScript Completions240
Ruby Completions239
Python Completions394
Total Stars89
% of votes with a positive feedback rating94% of 162
Total "Very Satisfied" Votes146
Total "Somewhat Satisfied" Votes14
Total "Not Satisfied" Votes2
Total Rank Assessments16
Average Assessed Rank
5 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • trip Avatar
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • Voile Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
Ad