How to resolve the algorithm Abbreviations, automatic step by step in the Transd programming language
How to resolve the algorithm Abbreviations, automatic step by step in the Transd programming language
Table of Contents
Problem Statement
The use of abbreviations (also sometimes called synonyms, nicknames, AKAs, or aliases) can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc.
It would make a list of words easier to maintain (as words are added, changed, and/or deleted) if the minimum abbreviation length of that list could be automatically (programmatically) determined.
For this task, use the list (below) of the days-of-the-week names that are expressed in about a hundred languages (note that there is a blank line in the list). Caveat: The list (above) most surely contains errors (or, at the least, differences) of what the actual (or true) names for the days-of-the-week.
To make this Rosetta Code task page as small as possible, if processing the complete list, read the days-of-the-week from a file (that is created from the above list).
Notes concerning the above list of words
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Abbreviations, automatic step by step in the Transd programming language
Source code in the transd programming language
#lang transd
MainModule : {
_start: (λ
(with fs FileStream() words String()
(open-r fs "D:\\Temp\\wordlist.txt")
(for line in (read-lines fs) do
(with days (split line " ") len 0
(for w in days do (for y in days do
(if (neq w y) (= len (max len (coincide w y))))))
(lout (+ len 1) " " days))
) ) )
}
You may also check:How to resolve the algorithm Factors of a Mersenne number step by step in the BBC BASIC programming language
You may also check:How to resolve the algorithm Quine step by step in the E programming language
You may also check:How to resolve the algorithm Align columns step by step in the Ruby programming language
You may also check:How to resolve the algorithm Cholesky decomposition step by step in the R programming language
You may also check:How to resolve the algorithm Sisyphus sequence step by step in the Phix programming language