A numeronym (also known as a "numerical contraction") is when a word is shortened using numbers. A common contraction method is to use the length of the replaced substring to replace all but the first and last characters. For example, use
i18n instead of
L10n instead of
L is capitalized since a lowercase one looks too similar to the
Of course, several words in the same phrase may have the same abbreviated form, so your job is to convert a group of words to their numeronyms, or in the event that there exists some different words with the same numeronym, your program should give a result of
A7s R4t, short for
Ambiguous Result (yes, I know that this result is itself an ambiguous result.)
- Use a program or function, and print or return the result.
- Input is taken as a single string.
- The output is a single string of space-delimited words.
- Your program need not convert words with length 3, and should not convert shorter words.
- If an
l(lowercase ell) would occur before a
1(one), it should be made uppercase.
- If an
I(uppercase eye) would occur before a
1(one), it should be made lowercase.
- Input will be printable ASCII and spaces. Words are separated by spaces.
- Shortest code wins.
A7s R4t -> A7s R4t (OR: A1s R1t, etc) Ambiguous Result -> A7s R4t Billy goats gruff -> B3y g3s g3f Thanks for the Memories -> T4s f1r the M6s (one possible answer, NOT: Thnks fr th Mmrs) Programming Puzzles & Code Golf -> P9g P5s & C2e G2f globalization -> g11n localizability -> L12y Internationalization or antidisestablishmentarianism -> i18n or a26m Internationalization or InternXXXXXalization -> A7s R4t what is this fiddle and faddle -> A7s R4t A be see -> A be s1e (OR: A be see) see sea -> s1e s1a (OR: see sea) 2B or not 2B -> 2B or not 2B (OR: 2B or n1t 2B. 2 letters, don't change, don't count as ambiguous) this example is this example -> t2s e5e is t2s e5e (same words aren't ambiguous) l1 -> l1 (2 letters, don't change.) I1 -> I1 (2 letters, don't change.)
Edit: If anyone didn't get the reference: Thnks fr th Mmrs