In the programming language of your choice, write a method that modifies a string using the following rules:
-
Each word in the input string is replaced with the following: the first letter of the word, the count of distinct letters between the first and last letter, and the last letter of the word. For example, "Automotive" would be replaced by "A6e".
-
A "word" is defined as a sequence of alphabetic characters, delimited by any non-alphabetic characters.
-
Any non-alphabetic character in the input string should appear in the output string in its original relative location.
Prerequisites: install ruby and bundler.
git clone git@gist.github.com:66bbcfad1a1a94693a18f5925bd2ef7c.git
cd 66bbcfad1a1a94693a18f5925bd2ef7c
bundle install
bundle exec rspec test.rb