stringtest.java

In the programming language of your choice, write a method that modifies a string using the following rules:

  1. 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".
  2. A "word" is defined as a sequence of alphabetic characters, delimited by any non-alphabetic characters.
  3. Any non-alphabetic character in the input string should appear in the output string in its original relative location.