Abbreviations, automatic

From Rosetta Code
Task
Abbreviations, automatic
You are encouraged to solve this task according to the task description, using any language you may know.

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).

Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
Ehud Segno Maksegno Erob Hamus Arbe Kedame
Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
domingu llunes martes miércoles xueves vienres sábadu
Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
nedelia ponedelnik vtornik sriada chetvartak petak sabota
sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
dimanche lundi mardi mercredi jeudi vendredi samedi
Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
Domingo Segunda_feira Martes Mércores Joves Venres Sábado
k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
vasárnap hétfö kedd szerda csütörtök péntek szombat
Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
sundio lundio mardio merkurdio jovdio venerdio saturdio
Minggu Senin Selasa Rabu Kamis Jumat Sabtu
Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
domenica lunedí martedí mercoledí giovedí venerdí sabato
Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
Jabot Manre Juje Wonje Taije Balaire Jarere
geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
sφndag mandag tirsdag onsdag torsdag fredag lφrdag
lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
djadomingo djaluna djamars djarason djaweps djabièrna djasabra
Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
Domingo Lunes martes Miercoles Jueves Viernes Sabado
Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
nedel^a pondelok utorok streda s^tvrtok piatok sobota
Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
domingo lunes martes miércoles jueves viernes sábado
sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
söndag måndag tisdag onsdag torsdag fredag lordag
Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
zuntik montik dinstik mitvokh donershtik fraytik shabes
iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
Sun Moon Mars Mercury Jove Venus Saturn
zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

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

  •   each line has a list of days-of-the-week for a language, separated by at least one blank
  •   the words on each line happen to be in order, from Sunday ──► Saturday
  •   most lines have words in mixed case and some have all manner of accented words and other characters
  •   some words were translated to the nearest character that was available to code page   437
  •   the characters in the words are not restricted except that they may not have imbedded blanks
  •   for this example, the use of an underscore (_) was used to indicate a blank in a word


Task
  •   The list of words   (days of the week)   needn't be verified/validated.
  •   Write a function to find the (numeric) minimum length abbreviation for each line that would make abbreviations unique.
  •   A blank line   (or a null line)   should return a null string.
  •   Process and show the output for at least the first five lines of the file.
  •   Show all output here.
Other tasks related to string operations:
Metrics
Counting
Remove/replace
Anagrams/Derangements/shuffling
Find/Search/Determine
Formatting
Song lyrics/poems/Mad Libs/phrases
Tokenize
Sequences



11l

Translation of: Python
F shortest_abbreviation_length(line, list_size)
   V words = line.split(‘ ’)
   V word_count = words.len
   I word_count != list_size
      X.throw ValueError(‘Not enough entries, expected #. found #.’.format(list_size, word_count))

   V abbreviation_length = 1
   L
      V abbreviations = Set(words.map(word -> word[0 .< @abbreviation_length]))
      I abbreviations.len == list_size
         R abbreviation_length
      abbreviation_length++

F automatic_abbreviations(filename, words_per_line)
   L(line) File(filename).read().split("\n")
      I line.len > 0
         V length = shortest_abbreviation_length(line, words_per_line)
         print(‘#2 #.’.format(length, line))
      E
         print()

automatic_abbreviations(‘daysOfWeek.txt’, 7)
Output:
 2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2 domingu llunes martes miércoles xueves vienres sábadu
 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

 7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2 dimanche lundi mardi mercredi jeudi vendredi samedi
 4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3 vasárnap hétfö kedd szerda csütörtök péntek szombat
 2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2 sundio lundio mardio merkurdio jovdio venerdio saturdio
 3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2 domenica lunedí martedí mercoledí giovedí venerdí sabato
 2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3 Jabot Manre Juje Wonje Taije Balaire Jarere
 5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2 domingo lunes martes miércoles jueves viernes sábado
 2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2 söndag måndag tisdag onsdag torsdag fredag lordag
 2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2 zuntik montik dinstik mitvokh donershtik fraytik shabes
 7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2 Sun Moon Mars Mercury Jove Venus Saturn
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

AArch64 Assembly

Works with: as version Raspberry Pi 3B version Buster 64 bits
/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program abbrAuto64.s   */
/* store list of day in a file listDays.txt*/
/* and run the program  abbrAuto64 listDays.txt */

/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"

.equ BUFFERSIZE,   10000
.equ NBMAXIDAYS, 7

/*********************************/
/* Initialized data              */
/*********************************/
.data
szMessTitre:            .asciz "Nom du fichier : "
szCarriageReturn:      .asciz "\n"
szMessErreur:          .asciz "Error detected.\n"
szMessErrBuffer:       .asciz "buffer size too less !!"
szSpace:               .asciz " "
/*********************************/
/* UnInitialized data            */
/*********************************/
.bss
.align 4
sZoneConv:      .skip 24
qAdrFicName:    .skip 8
iTabAdrDays:    .skip 8 * NBMAXIDAYS 
iTabAdrDays2:   .skip 8 * NBMAXIDAYS 
sBufferDays:    .skip BUFFERSIZE
sBuffer:        .skip BUFFERSIZE
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main 
main:                                // INFO: main
    mov x0,sp                        // stack address for load parameter
    bl traitFic                      // read file and process 

100:                                 // standard end of the program 
    mov x0, #0                       // return code
    mov x8, #EXIT                    // request to exit program
    svc #0                           // perform the system call
 
qAdrszCarriageReturn:      .quad szCarriageReturn
qAdrsZoneConv:             .quad sZoneConv

/******************************************************************/
/*     read file                                                   */ 
/******************************************************************/
/* x0 contains address stack begin           */
traitFic:                             // INFO: traitFic
    stp x1,lr,[sp,-16]!               // save  registres
    stp x2,x3,[sp,-16]!               // save  registres
    stp x4,x5,[sp,-16]!               // save  registres
    stp x6,x7,[sp,-16]!               // save  registres
    stp x8,fp,[sp,-16]!               // save  registres
    mov fp,x0                         //  fp <- start address
    ldr x4,[fp]                       // number of Command line arguments
    cmp x4,#1
    ble 99f
    add x5,fp,#16                      // second parameter address 
    ldr x5,[x5]
    ldr x0,qAdrqAdrFicName
    str x5,[x0]
    ldr x0,qAdrszMessTitre
    bl affichageMess                  // display string
    mov x0,x5
    bl affichageMess 
    ldr x0,qAdrszCarriageReturn
    bl affichageMess                  // display carriage return
    
    mov x0,AT_FDCWD
    mov x1,x5                         // file name
    mov x2,#O_RDWR                    // flags    
    mov x3,#0                         // mode 
    mov x8, #OPEN                     // call system OPEN 
    svc 0 
    cmp x0,#0                         // error ?
    ble 99f
    mov x7,x0                         // File Descriptor
    ldr x1,qAdrsBufferDays             // buffer address
    mov x2,#BUFFERSIZE                // buffer size
    mov x8,#READ                      // read file
    svc #0
    cmp x0,#0                         // error ?
    blt 99f
    // extraction datas
    ldr x1,qAdrsBufferDays             // buffer address
    add x1,x1,x0
    mov x0,#0                         // store zéro final
    strb w0,[x1] 
    ldr x0,qAdriTabAdrDays             // key string command table
    ldr x1,qAdrsBufferDays             // buffer address
    bl extracDatas
                                       // close file
    mov x0,x7
    mov x8, #CLOSE 
    svc 0 
    mov x0,#0
    b 100f
99:                                    // error
    ldr x0,qAdrszMessErreur            // error message
    bl  affichageMess
    mov x0,#-1
100:
    ldp x8,fp,[sp],16                  // restaur des  2 registres
    ldp x6,x7,[sp],16                  // restaur des  2 registres
    ldp x4,x5,[sp],16                  // restaur des  2 registres
    ldp x2,x3,[sp],16                  // restaur des  2 registres
    ldp x1,lr,[sp],16                  // restaur des  2 registres
    ret
qAdrqAdrFicName:              .quad qAdrFicName
qAdrszMessTitre:              .quad szMessTitre
qAdrszMessErreur:             .quad szMessErreur
qAdrsBuffer:                  .quad sBuffer
qAdrsBufferDays:              .quad sBufferDays
qAdriTabAdrDays:              .quad iTabAdrDays
/******************************************************************/
/*     extrac lines file buffer                                   */ 
/******************************************************************/
/* x0 contains strings address           */
/* x1 contains buffer address         */
extracDatas:                     // INFO: extracDatas
    stp x1,lr,[sp,-16]!          // save  registres
    stp x2,x3,[sp,-16]!          // save  registres
    stp x4,x5,[sp,-16]!          // save  registres
    stp x6,x7,[sp,-16]!          // save  registres
    stp x8,fp,[sp,-16]!          // save  registres
    mov x7,x0
    mov x6,x1
    mov x2,#0                    // string buffer indice
    mov x4,x1                    // start string
    mov x5,#0                    // string index
1:
    ldrb w3,[x6,x2]
    cmp w3,#0
    beq 4f                       // end
    cmp w3,#0xA
    beq 2f
    cmp w3,#' '                  // end string
    beq 3f
    add x2,x2,#1
    b 1b
2:
    mov x3,#0
    strb w3,[x6,x2]
    ldrb w3,[x6,x2]
    cmp w3,#0xD
    bne 21f
    add x2,x2,#2
    b 22f
21:
    add x2,x2,#1
22:
    mov x0,x4                   // store last day of line in table
    str x4,[x7,x5,lsl #3]
    mov x0,x5                   // days number
    bl traitLine                // process a line of days
    mov x5,#0                   // new line
    b 5f
 
3:
    mov x3,#0
    strb w3,[x6,x2]
    add x2,x2,#1
4:  
    mov x0,x4
    str x4,[x7,x5,lsl #3]
    add x5,x5,#1
5:                              // supress spaces 
    ldrb w3,[x6,x2]
    cmp w3,#0
    beq 100f
    cmp w3,#' '
    cinc x2,x2,eq
    beq 5b
    
    add x4,x6,x2                 // new start address
    b 1b
100:
    ldp x8,fp,[sp],16           // restaur des  2 registres
    ldp x6,x7,[sp],16           // restaur des  2 registres
    ldp x4,x5,[sp],16           // restaur des  2 registres
    ldp x2,x3,[sp],16           // restaur des  2 registres
    ldp x1,lr,[sp],16           // restaur des  2 registres
    ret
/******************************************************************/
/*     processing a line                                          */ 
/******************************************************************/
/* x0 contains days number in table   */
traitLine:                    // INFO: traitLine
    stp x1,lr,[sp,-16]!          // save  registres
    stp x2,x3,[sp,-16]!          // save  registres
    stp x4,x5,[sp,-16]!          // save  registres
    stp x6,x7,[sp,-16]!          // save  registres
    stp x8,x9,[sp,-16]!          // save  registres
    stp x10,x11,[sp,-16]!          // save  registres
    stp x12,x13,[sp,-16]!          // save  registres
    cmp x0,#1                 // one day ?
    bgt 1f                    // no

    ldr x0,qAdrszCarriageReturn // yes display empty line
    bl affichageMess
    b 100f
1:                            // line OK
    mov x6,x0                 // days number
    ldr x0,qAdriTabAdrDays
    ldr x1,qAdriTabAdrDays2
    mov x2,#0
11:                           // copy days table into other for display final
    ldr x3,[x0,x2,lsl #3]
    str x3,[x1,x2,lsl #3]
    add x2,x2,#1
    cmp x2,x6
    ble 11b
    ldr x0,qAdriTabAdrDays    // and sort first table
    mov x1,#0
    add x2,x6,#1
    bl insertionSort
    
    mov x8,#1                 // abbrevations counter
    ldr x12,qAdriTabAdrDays
    mov x2,#0
    ldr x10,[x12,x2,lsl #3]   // load first sorting day
    mov x11,#0
    mov x3,#1
2:                            // begin loop
    ldr x4,[x12,x3,lsl #3]    // load other day
    mov x0,x10                // day1
    mov x1,x4                 // day 2
    mov x2,#0                 // position 0
    bl compareChar
    cmp x0,#0                 // first letter equal ?
    beq 3f
    mov x10,x4                // no -> move day 2 in day 1
    b 6f
3:                            // if equal
    mov x7,x1                 // characters length (1,2,3)
    mov x11,#1                // letters position
4:                            // loop to compare letters days
    mov x0,x10
    mov x1,x4
    mov x2,x7
    bl compareChar
    cmp x0,#0
    bne 5f
    cmp x5,#0                 // if end
    beq 5f
    add x7,x7,x1              // next character
    add x11,x11,#1            // count letter
    b 4b
5:
    add x11,x11,#1            // increment letters position
    cmp x11,x8                // and store if > position précedente
    csel x8,x11,x8,gt
    //movgt x8,x11
    mov x10,x4                 // and day1 = day2
    
6:               
    add x3,x3,#1              // increment day
    cmp x3,x6                 
    ble 2b                    // and loop
    
    mov x0,x8                 // display position letter
    ldr x1,qAdrsZoneConv
    bl conversion10
    //mov x2,#0
    //strb x2,[x1,x0]
    ldr x0,qAdrsZoneConv
    bl affichageMess
    ldr x0,qAdrszSpace
    bl affichageMess
    ldr x0,qAdriTabAdrDays2   // and display list origine days
    mov x1,x6
    bl displayListDays
    
100:
    ldp x12,x13,[sp],16         // restaur des  2 registres
    ldp x10,x11,[sp],16         // restaur des  2 registres
    ldp x8,x9,[sp],16           // restaur des  2 registres
    ldp x6,x7,[sp],16           // restaur des  2 registres
    ldp x4,x5,[sp],16           // restaur des  2 registres
    ldp x2,x3,[sp],16           // restaur des  2 registres
    ldp x1,lr,[sp],16           // restaur des  2 registres
    ret
qAdrszSpace:          .quad szSpace
qAdriTabAdrDays2:     .quad iTabAdrDays2
/******************************************************************/
/*     comparison character unicode                               */ 
/******************************************************************/
/* x0 contains address first string            */
/* x1 contains address second string */
/* x2 contains the character position to compare  */
/* x0 return 0 if equal 1 if > -1 if < */
/* x1 return character S1 size in octet if equal */
/* x2 return character S2 size in octet */
compareChar:
    stp lr,x3,[sp,-16]!          // save  registres
    stp x4,x5,[sp,-16]!          // save  registres
    stp x6,x7,[sp,-16]!          // save  registres
    stp x8,x9,[sp,-16]!          // save  registres
    ldrb w3,[x0,x2]
    ldrb w4,[x1,x2]
    cmp w3,w4                    // compare first byte
    blt 3f
    bgt 4f
    bne 100f
    and w3,w3,#0b11100000           // 3 bytes ?
    cmp w3,#0b11100000
    bne 1f
    add x2,x2,#1
    ldrb w3,[x0,x2]
    ldrb w4,[x1,x2]
    cmp w3,w4
    blt 3f
    bgt 4f
    bne 100f
    add x2,x2,#1
    ldrb w3,[x0,x2]
    ldrb w4,[x1,x2]
    cmp w3,w4
    blt 3f
    bgt 4f
    bne 100f
    mov x0,#0
    mov x1,#3
    b 100f
1:
    cmp w3,#0b11000000           // 2 bytes ?
    bne 2f
    add x2,x2,#1
    ldrb w3,[x0,x2]
    ldrb w4,[x1,x2]
    cmp w3,w4
    blt 3f
    bgt 4f
    bne 100f
    mov x0,#0
    mov x1,#2
    b 100f
2:                              // 1 byte
    mov x0,#0
    mov x1,#1
    b 100f
3:
    mov x0,#-1
    b 100f
4:
    mov x0,#1
100:
    ldp x8,x9,[sp],16           // restaur des  2 registres
    ldp x6,x7,[sp],16           // restaur des  2 registres
    ldp x4,x5,[sp],16           // restaur des  2 registres
    ldp lr,x3,[sp],16           // restaur des  2 registres
    ret
/******************************************************************/
/*     control load                                      */ 
/******************************************************************/
/* x0 contains string table           */
/* x1 contains days number */
displayListDays:
    stp x1,lr,[sp,-16]!          // save  registres
    stp x2,x3,[sp,-16]!          // save  registres
    stp x4,x5,[sp,-16]!          // save  registres
    stp x6,x7,[sp,-16]!          // save  registres
    stp x8,x9,[sp,-16]!          // save  registres
    mov x5,x0
    mov x2,#0
1:
    cmp x2,x1
    bgt 2f
    ldr x0,[x5,x2,lsl #3]
    bl affichageMess
    ldr x0,qAdrszSpace
    bl affichageMess
    add x2,x2,#1
    b 1b
2:
    ldr x0,qAdrszCarriageReturn
    bl affichageMess
100:
    ldp x8,x9,[sp],16           // restaur des  2 registres
    ldp x6,x7,[sp],16           // restaur des  2 registres
    ldp x4,x5,[sp],16           // restaur des  2 registres
    ldp x2,x3,[sp],16           // restaur des  2 registres
    ldp x1,lr,[sp],16           // restaur des  2 registres
    ret
/************************************/       
/* Strings case sensitive comparisons  */
/************************************/      
/* x0 et x1 contains the address of strings */
/* return 0 in x0 if equals */
/* return -1 if string x0 < string x1 */
/* return 1  if string x0 > string x1 */
comparStrings:
    stp x1,lr,[sp,-16]!          // save  registres
    stp x2,x3,[sp,-16]!          // save  registres
    stp x4,x5,[sp,-16]!          // save  registres
    mov x2,#0                // counter
1:    
    ldrb w3,[x0,x2]          // byte string 1
    ldrb w4,[x1,x2]          // byte string 2
    cmp w3,w4
    blt 2f
    bgt 3f
    bne 100f                 // not equals
    cmp w3,#0                // 0 end string
    beq 4f                   // end string
    add x2,x2,#1             // else add 1 in counter
    b 1b                     // and loop
2:
    mov x0,#-1               // small
    b 100f
3:
    mov x0,#1                // greather
    b 100f
4:
    mov x0,#0                // equal 
100:
    ldp x4,x5,[sp],16           // restaur des  2 registres
    ldp x2,x3,[sp],16           // restaur des  2 registres
    ldp x1,lr,[sp],16           // restaur des  2 registres
    ret
/******************************************************************/
/*         insertion sort                                              */ 
/******************************************************************/
/* x0 contains the address of table */
/* x1 contains the first element    */
/* x2 contains the number of element */
insertionSort:
    stp x1,lr,[sp,-16]!          // save  registres
    stp x2,x3,[sp,-16]!          // save  registres
    stp x4,x5,[sp,-16]!          // save  registres
    stp x6,x7,[sp,-16]!          // save  registres
    mov x6,x0
    add x3,x1,#1                       // start index i
1:                                     // start loop
    ldr x1,[x6,x3,lsl #3]              // load value A[i]
    sub x5,x3,#1                       // index j
2:
    ldr x4,[x6,x5,lsl #3]              // load value A[j]
    mov x0,x4
    bl comparStrings
    cmp x0,#1                          // compare value
    bne 3f
    add x5,x5,#1                          // increment index j
    str x4,[x6,x5,lsl #3]              // store value A[j+1]
    subs x5,x5,#2                         // j = j - 1
    bge 2b                             // loop if j >= 0
3:
    add x5,x5,#1                          // increment index j
    str x1,[x6,x5,lsl #3]              // store value A[i] in A[j+1]
    add x3,x3,#1                          // increment index i
    cmp x3,x2                          // end ?
    blt 1b                             // no -> loop

100:
    ldp x6,x7,[sp],16           // restaur des  2 registres
    ldp x4,x5,[sp],16           // restaur des  2 registres
    ldp x2,x3,[sp],16           // restaur des  2 registres
    ldp x1,lr,[sp],16           // restaur des  2 registres
    ret
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"
Nom du fichier : listDays.txt
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Ada

with Ada.Containers.Indefinite_Vectors;
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
with Ada.Text_IO;

procedure Abbreviations is

   package String_Vectors is
     new Ada.Containers.Indefinite_Vectors (Index_Type   => Positive,
                                            Element_Type => String);
   use Ada.Text_IO, String_Vectors;

   function Split (Line : String) return Vector is
      Result : Vector;
      First  : Natural;
      Last   : Natural := Line'First - 1;
   begin
      while Last + 1 in Line'Range loop
         Ada.Strings.Fixed.Find_Token
           (Line, Ada.Strings.Maps.To_Set (" "), Last + 1,
            Ada.Strings.Outside, First, Last);
         exit when Last = 0;
         Append (Result, Line (First .. Last));
      end loop;
      return Result;
   end Split;

   function Abbrev_Length (Items : Vector) return Natural is
      use type Ada.Containers.Count_Type;
      Max     : Natural := 0;
      Abbrevs : Vector;
   begin
      for Item of Items loop
         Max := Natural'Max (Max, Item'Length);
      end loop;

      for Length in 1 .. Max loop
         Abbrevs := Empty_Vector;
         for Item of Items loop
            declare
               Last : constant Natural
                 := Natural'Min (Item'Last, Item'First + Length - 1);

               Abbrev : String renames Item (Item'First .. Last);
            begin
               exit when Abbrevs.Contains (Abbrev);
               Abbrevs.Append (Abbrev);
            end;
         end loop;
         if Abbrevs.Length = Items.Length then
            return Length;
         end if;
      end loop;
      return 0;
   end Abbrev_Length;

   procedure Process (Line : String) is
      package Natural_IO is new Ada.Text_IO.Integer_IO (Natural);
      Words  : constant Vector  := Split (Line);
      Length : constant Natural := Abbrev_Length (Words);
   begin
      Natural_IO.Put (Length, Width => 2);
      Put (" ");
      Put_Line (Line);
   end Process;

begin
   while not End_Of_File loop
      Process (Get_Line);
   end loop;
end Abbreviations;
Output:
% ./abbreviations <days-of-week.txt
 2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2 domingu llunes martes miércoles xueves vienres sábadu
 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 0
 7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2 dimanche lundi mardi mercredi jeudi vendredi samedi
 4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 7 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3 vasárnap hétfö kedd szerda csütörtök péntek szombat
 2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2 sundio lundio mardio merkurdio jovdio venerdio saturdio
 3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 5 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2 domenica lunedí martedí mercoledí giovedí venerdí sabato
 2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3 Jabot Manre Juje Wonje Taije Balaire Jarere
 5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2 domingo lunes martes miércoles jueves viernes sábado
 2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2 söndag måndag tisdag onsdag torsdag fredag lordag
 2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 7 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 9 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2 zuntik montik dinstik mitvokh donershtik fraytik shabes
 7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
15 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2 Sun Moon Mars Mercury Jove Venus Saturn
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Amazing Hopper

#include <jambo.h>

#define MAX_LINE   150
Main
   Break on
   days of week = 0, fd=0, length=0, days=0, temp=0
   
   Open in("dias_de_la_semana.txt")( fd )
   If ( Not( File error ) )
      Loop if (Not (Eof(fd)) ) 
         Using( MAX_LINE ), Split( Readlin(fd) » (days), days of week, " ")

         Continue if( Zero( Length( days of week ) » (length) ) )
         i=1
         Loop
            Let( temp := Ucase(Left( i, days of week )))
            aSort(temp)
            Break if ( Eq(Length(Unique(temp)), length ) )
            ++i
         Back

         Printnl( Cpad(" ",3,Str(i))," : ", Utf8(Ansi(days)) )
      Back
      Close(fd)
   Else
      Printnl("Error en archivo: ", ~Get str file error)
   End If
End
Output:
$ hopper abreviatura.jambo 
 2  : Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  : Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  : E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  : Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  : Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit

ARM Assembly

Works with: as version Raspberry Pi
/* ARM assembly Raspberry PI  */
/*  program abbrAuto.s   */
/* store list of day in a file listDays.txt*/
/* and run the program  abbrAuto listDays.txt */

/* REMARK 1 : this program use routines in a include file 
   see task Include a file language arm assembly 
   for the routine affichageMess conversion10 
   see at end of this program the instruction include */
/* for constantes see task include a file in arm assembly */
/************************************/
/* Constantes                       */
/************************************/
.include "../constantes.inc"

.equ STDIN,  0     @ Linux input console
.equ STDOUT, 1     @ Linux output console
.equ EXIT,   1     @ Linux syscall
.equ READ,   3     @ Linux syscall
.equ WRITE,  4     @ Linux syscall
.equ OPEN,   5     @ Linux syscall
.equ CLOSE,  6     @ Linux syscall

.equ O_RDWR,    0x0002        @ open for reading and writing

.equ BUFFERSIZE,   10000
.equ NBMAXIDAYS, 7

/*********************************/
/* Initialized data              */
/*********************************/
.data
szMessTitre:            .asciz "Nom du fichier : "
szCarriageReturn:      .asciz "\n"
szMessErreur:          .asciz "Error detected.\n"
szMessErrBuffer:       .asciz "buffer size too less !!"
szSpace:               .asciz " "
/*********************************/
/* UnInitialized data            */
/*********************************/
.bss
.align 4
sZoneConv:      .skip 24
iAdrFicName:    .skip 4
iTabAdrDays:    .skip 4 * NBMAXIDAYS 
iTabAdrDays2:   .skip 4 * NBMAXIDAYS 
sBufferDays:    .skip BUFFERSIZE
sBuffer:        .skip BUFFERSIZE
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main 
main:                                @ INFO: main
    mov r0,sp                        @ stack address for load parameter
    bl traitFic                      @ read file and process 

100:                                 @ standard end of the program 
    mov r0, #0                       @ return code
    mov r7, #EXIT                    @ request to exit program
    svc #0                           @ perform the system call
 
iAdrszCarriageReturn:      .int szCarriageReturn
//iAdrszMessErrBuffer:       .int szMessErrBuffer
iAdrsZoneConv:             .int sZoneConv


/******************************************************************/
/*     read file                                                   */ 
/******************************************************************/
/* r0 contains address stack begin           */
traitFic:                             @ INFO: traitFic
    push {r1-r8,fp,lr}                @ save  registers
    mov fp,r0                         @  fp <- start address
    ldr r4,[fp]                       @ number of Command line arguments
    cmp r4,#1
    movle r0,#-1
    ble 99f
    add r5,fp,#8                      @ second parameter address 
    ldr r5,[r5]
    ldr r0,iAdriAdrFicName
    str r5,[r0]
    ldr r0,iAdrszMessTitre
    bl affichageMess                  @ display string
    mov r0,r5
    bl affichageMess 
    ldr r0,iAdrszCarriageReturn
    bl affichageMess                  @ display carriage return

    mov r0,r5                         @ file name
    mov r1,#O_RDWR                    @ flags    
    mov r2,#0                         @ mode 
    mov r7, #OPEN                     @ call system OPEN 
    svc 0 
    cmp r0,#0                         @ error ?
    ble 99f
    mov r8,r0                         @ File Descriptor
    ldr r1,iAdrsBufferDays             @ buffer address
    mov r2,#BUFFERSIZE                @ buffer size
    mov r7,#READ                      @ read file
    svc #0
    cmp r0,#0                         @ error ?
    blt 99f
    @ extraction datas
    ldr r1,iAdrsBufferDays             @ buffer address
    add r1,r0
    mov r0,#0                         @ store zéro final
    strb r0,[r1] 
    ldr r0,iAdriTabAdrDays             @ key string command table
    ldr r1,iAdrsBufferDays             @ buffer address
    bl extracDatas
                                      @ close file
    mov r0,r8
    mov r7, #CLOSE 
    svc 0 
    mov r0,#0
    b 100f
99:                                   @ error
    ldr r1,iAdrszMessErreur           @ error message
    bl   displayError
    mov r0,#-1
100:
    pop {r1-r8,fp,lr}                 @ restaur registers 
    bx lr                             @return
iAdriAdrFicName:              .int iAdrFicName
iAdrszMessTitre:              .int szMessTitre
iAdrszMessErreur:             .int szMessErreur
iAdrsBuffer:                  .int sBuffer
iAdrsBufferDays:              .int sBufferDays
iAdriTabAdrDays:              .int iTabAdrDays
/******************************************************************/
/*     extrac lines file buffer                                   */ 
/******************************************************************/
/* r0 contains strings address           */
/* r1 contains buffer address         */
extracDatas:                     @ INFO: extracDatas
    push {r1-r8,lr}              @ save  registers
    mov r7,r0
    mov r6,r1
    mov r2,#0                    @ string buffer indice
    mov r4,r1                    @ start string
    mov r5,#0                    @ string index
1:
    ldrb r3,[r6,r2]
    cmp r3,#0
    beq 4f                       @ end
    cmp r3,#0xA
    beq 2f
    cmp r3,#' '                  @ end string
    beq 3f
    add r2,#1
    b 1b
2:
    mov r3,#0
    strb r3,[r6,r2]
    ldrb r3,[r6,r2]
    cmp r3,#0xD
    addeq r2,#2
    addne r2,#1
    mov r0,r4                   @ store last day of line in table
    str r4,[r7,r5,lsl #2]
    mov r0,r5                   @ days number
    bl traitLine                @ process a line of days
    mov r5,#0                   @ new line
    b 5f
 
3:
    mov r3,#0
    strb r3,[r6,r2]
    add r2,#1
4:  
    mov r0,r4
    str r4,[r7,r5,lsl #2]
    add r5,#1
5:                              @ supress spaces 
    ldrb r3,[r6,r2]
    cmp r3,#0
    beq 100f
    cmp r3,#' '
    addeq r2,r2,#1
    beq 5b
    
    add r4,r6,r2                 @ new start address
    b 1b
100:
    pop {r1-r8,lr}               @ restaur registers 
    bx lr                        @return
    
/******************************************************************/
/*     processing a line                                          */ 
/******************************************************************/
/* r0 contains days number in table   */
traitLine:                    @ INFO: traitLine
    push {r1-r12,lr}           @ save  register
    cmp r0,#1                 @ one day ?
    bgt 1f                    @ no

    ldr r0,iAdrszCarriageReturn @ yes display empty line
    bl affichageMess
    b 100f
1:                            @ line OK
    mov r6,r0                 @ days number
    ldr r0,iAdriTabAdrDays
    ldr r1,iAdriTabAdrDays2
    mov r2,#0
11:                           @ copy days table into other for display final
    ldr r3,[r0,r2,lsl #2]
    str r3,[r1,r2,lsl #2]
    add r2,#1
    cmp r2,r6
    ble 11b
    ldr r0,iAdriTabAdrDays    @ and sort first table
    mov r1,#0
    add r2,r6,#1
    bl insertionSort
    
    mov r8,#1                 @ abbrevations counter
    ldr r12,iAdriTabAdrDays
    mov r2,#0
    ldr r10,[r12,r2,lsl #2]   @ load first sorting day
    mov r11,#0
    mov r3,#1
2:                            @ begin loop
    ldr r4,[r12,r3,lsl #2]    @ load other day
    @ 1er lettre identique
    mov r0,r10                @ day1
    mov r1,r4                 @ day 2
    mov r2,#0                 @ position 0
    bl compareChar
    cmp r0,#0                 @ first letter equal ?
    movne r10,r4              @ no -> move day 2 in day 1
    bne 6f
3:                            @ if equal
    mov r7,r1                 @ characters length (1,2,3)
    mov r11,#1                @ letters position
4:                            @ loop to compare letters days
    mov r0,r10
    mov r1,r4
    mov r2,r7
    bl compareChar
    cmp r0,#0
    bne 5f
    cmp r5,#0                 @ if end
    beq 5f
    add r7,r7,r1              @ next character
    add r11,r11,#1            @ count letter
    b 4b
5:
    add r11,r11,#1            @ increment letters position
    cmp r11,r8                @ and store if > position précedente
    movgt r8,r11
    mov r10,r4                 @ and day1 = day2
    
6:               
    add r3,r3,#1              @ increment day
    cmp r3,r6                 
    ble 2b                    @ and loop
    
    mov r0,r8                 @ display position letter
    ldr r1,iAdrsZoneConv
    bl conversion10
    mov r2,#0
    strb r2,[r1,r0]
    ldr r0,iAdrsZoneConv
    bl affichageMess
    ldr r0,iAdrszSpace
    bl affichageMess
    ldr r0,iAdriTabAdrDays2   @ and display list origine days
    mov r1,r6
    bl displayListDays
    
100:
    pop {r1-r12,lr}              @ restaur registers 
    bx lr                        @return 
iAdrszSpace:          .int szSpace
iAdriTabAdrDays2:     .int iTabAdrDays2
/******************************************************************/
/*     comparison character unicode                               */ 
/******************************************************************/
/* r0 contains address first string            */
/* r1 contains address second string */
/* r2 contains the character position to compare  */
/* r0 return 0 if equal 1 if > -1 if < */
/* r1 return character S1 size in octet if equal */
/* r2 return character S2 size in octet */
compareChar:
    push {r3-r8,lr}              @ save  registers
    ldrb r3,[r0,r2]
    ldrb r4,[r1,r2]
    cmp r3,r4                    @ compare first byte
    movlt r0,#-1
    movgt r0,#1 
    bne 100f
    and r3,#0b11100000           @ 3 bytes ?
    cmp r3,#0b11100000
    bne 1f
    add r2,#1
    ldrb r3,[r0,r2]
    ldrb r4,[r1,r2]
    cmp r3,r4
    movlt r0,#-1
    movgt r0,#1 
    bne 100f
    add r2,#1
    ldrb r3,[r0,r2]
    ldrb r4,[r1,r2]
    cmp r3,r4
    movlt r0,#-1
    movgt r0,#1 
    bne 100f
    mov r0,#0
    mov r1,#3
    b 100f
1:
    and r3,#0b11100000           @ 2 bytes ?
    cmp r3,#0b11000000
    bne 2f
    add r2,#1
    ldrb r3,[r0,r2]
    ldrb r4,[r1,r2]
    cmp r3,r4
    movlt r0,#-1
    movgt r0,#1 
    bne 100f
    mov r0,#0
    mov r1,#2
    b 100f
2:                              @ 1 byte
    mov r0,#0
    mov r1,#1

100:
    pop {r3-r8,lr}              @ restaur registers 
    bx lr                       @return
/******************************************************************/
/*     control load                                      */ 
/******************************************************************/
/* r0 contains string table           */
/* r1 contains days number */
displayListDays:
    push {r1-r8,lr}              @ save  registers
    mov r5,r0
    mov r2,#0
1:
    cmp r2,r1
    bgt 2f
    ldr r0,[r5,r2,lsl #2]
    bl affichageMess
    ldr r0,iAdrszSpace
    bl affichageMess
    add r2,r2,#1
    b 1b
2:
    ldr r0,iAdrszCarriageReturn
    bl affichageMess
100:
    pop {r1-r8,lr}               @ restaur registers 
    bx lr                        @return
/************************************/       
/* Strings case sensitive comparisons  */
/************************************/      
/* r0 et r1 contains the address of strings */
/* return 0 in r0 if equals */
/* return -1 if string r0 < string r1 */
/* return 1  if string r0 > string r1 */
comparStrings:
    push {r1-r4}             @ save des registres
    mov r2,#0                @ counter
1:    
    ldrb r3,[r0,r2]          @ byte string 1
    ldrb r4,[r1,r2]          @ byte string 2
    cmp r3,r4
    movlt r0,#-1             @ small
    movgt r0,#1              @ greather
    bne 100f                 @ not equals
    cmp r3,#0                @ 0 end string
    moveq r0,#0              @ equal 
    beq 100f                 @ end string
    add r2,r2,#1             @ else add 1 in counter
    b 1b                     @ and loop
100:
    pop {r1-r4}
    bx lr   
/******************************************************************/
/*         insertion sort                                              */ 
/******************************************************************/
/* r0 contains the address of table */
/* r1 contains the first element    */
/* r2 contains the number of element */
insertionSort:
    push {r1-r6,lr}                    @ save registers
    mov r6,r0
    add r3,r1,#1                       @ start index i
1:                                     @ start loop
    ldr r1,[r6,r3,lsl #2]              @ load value A[i]
    sub r5,r3,#1                       @ index j
2:
    ldr r4,[r6,r5,lsl #2]              @ load value A[j]
    mov r0,r4
    bl comparStrings
    cmp r0,#1                          @ compare value
    bne 3f
    add r5,#1                          @ increment index j
    str r4,[r6,r5,lsl #2]              @ store value A[j+1]
    subs r5,#2                         @ j = j - 1
    bge 2b                             @ loop if j >= 0
3:
    add r5,#1                          @ increment index j
    str r1,[r6,r5,lsl #2]              @ store value A[i] in A[j+1]
    add r3,#1                          @ increment index i
    cmp r3,r2                          @ end ?
    blt 1b                             @ no -> loop

100:
    pop {r1-r6,lr}
    bx lr   
/***************************************************/
/*      ROUTINES INCLUDE                           */
/***************************************************/
.include "../affichage.inc"
Nom du fichier : listDays.txt
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

AutoHotkey

AutoAbbreviations(line){
    len := prev := 0
    Days := StrSplit(line, " ")
    loop % StrLen(Days.1)
    {
        obj := []
        for j, day in Days
        {
            abb := SubStr(day, 1, len)
            obj[abb] := (obj[abb] ? obj[abb] : 0) + 1
            if (obj[abb] > 1)
            {
                len++
                break
            }
        }
        if (prev = len)
            break
        prev := len
    }
    return len
}

Examples:

data := "
(
Sunday Monday Tuesday Wednesday Thursday Friday Saturday

Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
Ehud Segno Maksegno Erob Hamus Arbe Kedame
Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
)"

for i, line in StrSplit(data, "`n", "`r")
{
    line := RegExReplace(line, "\s+", " ")
    len := AutoAbbreviations(line)
    abbrev := ""
    for j, day in StrSplit(line, " ")
        abbrev .= SubStr(day, 1, len) " "
    result .= len " > " abbrev "`n"
}
MsgBox % result
return
Output:
2 > Su Mo Tu We Th Fr Sa 
0 > 
2 > So Ma Di Wo Do Vr Sa 
4 > E_dj E_hë E_ma E_më E_en E_pr E_sh 
2 > Eh Se Ma Er Ha Ar Ke 
5 > Al_Ah Al_It Al_Th Al_Ar Al_Ka Al_Go Al_Sa 

Another solution could be:

Loop, Read, days-of-the-week.txt  ; input text in current dir
	{
		if (A_Index > 10)   ; number of lines to output
			break
		Loop, Parse, A_LoopReadLine, %A_Space%  ; create an array of the days
			word%A_Index% := A_LoopField        ; word1=sunday, word2=monday ...
		loop 
			{
				x := A_Index   ;save the last loop index
				abrev := ""
				loop 7
					abrev .= SubStr(word%A_Index%, 1, x) . ","   ; x = length to test (1,2,3...) 
				sort, abrev, U D,                                ; sort unique (errorlevel = duplicates) 
			}
		until ErrorLevel = 0   ;stay with last loop index (length)
		minimalAb .= x . " " . A_LoopReadLine . " (" . abrev . ")`n"
	}
msgbox % minimalAb
ExitApp
Output:
Abbreviations Automatic.ahk
---------------------------
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday (Fr,Mo,Sa,Su,Th,Tu,We,)
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag (Di,Do,Ma,Sa,So,Vr,Wo,)
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë (E_dj,E_en,E_hÃ,E_ma,E_mÃ,E_pr,E_sh,)
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame (Ar,Eh,Er,Ha,Ke,Ma,Se,)
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit (Al_Ah,Al_Ar,Al_Go,Al_It,Al_Ka,Al_Sa,Al_Th,)
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat (Guir,Hink,Ourp,Shap,Tcho,Yere,Yerg,)
2 domingu llunes martes miércoles xueves vienres sábadu (do,ll,ma,mi,sÃ,vi,xu,)
2 Bazar_gÃœnÃœ Birinci_gÃœn Çkinci_gÃœn ÜçÜncÃœ_gÃœn DÖrdÃœncÃœ_gÃœn Bes,inci_gÃœn Altòncò_gÃœn (Al,Ba,Be,Bi,DÃ,Ãœ,Ç,)
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat (Astear,Asteaz,Astele,Igande,Larunb,Ostegu,Ostira,)
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar (BRih,Budh,Mong,Robi,Shom,Shon,Shuk,)
---------------------------
OK   

AWK

# syntax: GAWK -f ABBREVIATIONS_AUTOMATIC.AWK ABBREVIATIONS_AUTOMATIC.TXT
{ dow_arr[NR] = $0 }
END {
    for (i=1; i<=NR; i++) {
      if (split(dow_arr[i],arr1,FS) != 7) {
        printf("NG %s\n",dow_arr[i])
        continue
      }
      col_width = 0
      for (j=1; j<=7; j++) {
        col_width = max(col_width,length(arr1[j]))
      }
      for (col=1; col<=col_width; col++) {
        delete arr2
        for (j=1; j<=7; j++) {
          arr2[toupper(substr(arr1[j],1,col))]
        }
        if (length(arr2) == 7) {
          break
        }
        if (col >= col_width) { # catches duplicate day names
          col = "NG"
          break
        }
      }
      printf("%2s %s\n",col,dow_arr[i])
    }
    exit(0)
}
function max(x,y) { return((x > y) ? x : y) }
Output:
 2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2 domingu llunes martes miércoles xueves vienres sábadu
 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
NG
 7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2 dimanche lundi mardi mercredi jeudi vendredi samedi
 4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3 vasárnap hétfö kedd szerda csütörtök péntek szombat
 2 Sunnudagur Mánudagur ¦ridjudagur Midvikudagar Fimmtudagur FÖstudagur Laugardagur
 2 sundio lundio mardio merkurdio jovdio venerdio saturdio
 3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2 domenica lunedí martedí mercoledí giovedí venerdí sabato
 2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3 Jabot Manre Juje Wonje Taije Balaire Jarere
 5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2 sfndag mandag tirsdag onsdag torsdag fredag lfrdag
 7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 2 Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2 domingo lunes martes miércoles jueves viernes sábado
 2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2 söndag måndag tisdag onsdag torsdag fredag lordag
 2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2 zuntik montik dinstik mitvokh donershtik fraytik shabes
 7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2 Sun Moon Mars Mercury Jove Venus Saturn
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

BQN

File I/O works in CBQN.

This is a recursive function which checks uniqueness of n length prefix, and returns the iteration where all are unique.

Split ← (⊢-˜+`׬)∘=⊔⊢

Abbrnum ← 1⊸{
  𝕊⟨⟩:@;
  ((⊢≡⍷)𝕨↑¨𝕩)◶⟨(𝕨+1)⊸𝕊,𝕨⟩𝕩}
words ← ' ' Split¨ •FLines "abbrs.txt"

(•Show Abbrnum ≍○< ⊢)¨words
⟨ 2 ⟨ "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" ⟩ ⟩
⟨ 2 ⟨ "Sondag" "Maandag" "Dinsdag" "Woensdag" "Donderdag" "Vrydag" "Saterdag" ⟩ ⟩
⟨ 4 ⟨ "E_djelë" "E_hënë" "E_martë" "E_mërkurë" "E_enjte" "E_premte" "E_shtunë" ⟩ ⟩
⟨ 2 ⟨ "Ehud" "Segno" "Maksegno" "Erob" "Hamus" "Arbe" "Kedame" ⟩ ⟩
⟨ 5 ⟨ "Al_Ahad" "Al_Ithinin" "Al_Tholatha'a" "Al_Arbia'a" "Al_Kamis" "Al_Gomia'a" "Al_Sabit" ⟩ ⟩
...

C

Translation of: C#
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void process(int lineNum, char buffer[]) {
    char days[7][64];
    int i = 0, d = 0, j = 0;

    while (buffer[i] != 0) {
        if (buffer[i] == ' ') {
            days[d][j] = '\0';
            ++d;
            j = 0;
        } else if (buffer[i] == '\n' || buffer[i] == '\r') {
            days[d][j] = '\0';
            ++d;
            break;
        } else {
            days[d][j] = buffer[i];
            ++j;
        }

        if (d >= 7) {
            printf("There aren't 7 days in line %d\n", lineNum);
            return;
        }
        ++i;
    }
    if (buffer[i] == '\0') {
        days[d][j] = '\0';
        ++d;
    }

    if (d < 7) {
        printf("There aren't 7 days in line %d\n", lineNum);
        return;
    } else {
        int len = 0;

        for (len = 1; len < 64; ++len) {
            int d1;
            for (d1 = 0; d1 < 7; ++d1) {
                int d2;
                for (d2 = d1 + 1; d2 < 7; ++d2) {
                    int unique = 0;
                    for (i = 0; i < len; ++i) {
                        if (days[d1][i] != days[d2][i]) {
                            unique = 1;
                            break;
                        }
                    }
                    if (!unique) {
                        goto next_length;
                    }
                }
            }

            // uniqueness found for this length
            printf("%2d ", len);
            for (i = 0; i < 7; ++i) {
                printf(" %s", days[i]);
            }
            printf("\n");
            return;

            // a duplication was found at the current length
        next_length: {}
        }
    }

    printf("Failed to find uniqueness within the bounds.");
}

int main() {
    char buffer[1024];
    int lineNum = 1, len;
    FILE *fp;

    fp = fopen("days_of_week.txt", "r");
    while (1) {
        memset(buffer, 0, sizeof(buffer));

        fgets(buffer, sizeof(buffer), fp);
        len = strlen(buffer);

        if (len == 0 || buffer[len - 1] == '\0') {
            break;
        }

        process(lineNum++, buffer);
    }
    fclose(fp);

    return 0;
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelδ E_hδnδ E_martδ E_mδrkurδ E_enjte E_premte E_shtunδ
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miΘrcoles xueves vienres sßbadu
 2  Bazar_g▄n▄ Birinci_g▄n ╟kinci_g▄n ▄τ▄nc▄_g▄n D╓rd▄nc▄_g▄n Bes,inci_g▄n Alt≥nc≥_g▄n
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi MΦkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lφ ·ter  str^eda c^tvrtek pßtek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Ja∙do Vendredo Sabato
 1  p▄hapΣev esmaspΣev teisipΣev kolmapΣev neljapΣev reede laupΣev
There aren't 7 days in line 26
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mßnadagur t sdaguy mikudagur h≤sdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes MΘrcores Joves Venres Sßbado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  p≤pule p≤`akahi p≤`alua p≤`akolu p≤`ahß p≤`alima p≤`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasßrnap hΘtf÷ kedd szerda csⁿt÷rt÷k pΘntek szombat
 2  Sunnudagur Mßnudagur ªridjudagur Midvikudagar Fimmtudagur F╓studagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  DΘ_Domhnaigh DΘ_Luain DΘ_Mßirt DΘ_Ceadaoin DΘ_ardaoin DΘ_hAoine DΘ_Sathairn
 2  domenica lunedφ martedφ mercoledφ giovedφ venerdφ sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunµ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_r∞ xing-_qi-_yi-. xing-_qi-_Φr xing-_qi-_san-. xing-_qi-_s∞ xing-_qi-_wuv. xing-_qi-_li∙
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo min≥mishi mßrtes miΦrkoles misheushi bΦrnashi mishßbaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sfndag mandag tirsdag onsdag torsdag fredag lfrdag
 7  lo_dimenge lo_diluns lo_dimarτ lo_dimΦrcres lo_dij≥us lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabiΦrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terτa-feire quarta-feire quinta-feire sexta-feira sσbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminic¬ Luni Mart'i Miercuri Joi Vineri SΓmb¬t¬
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-mαirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miΘrcoles jueves viernes sßbado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  s÷ndag mσndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  LΘ-pαi-jφt Pαi-it Pαi-j∩ Pαi-sa± Pαi-s∞ Pαi-g╓. Pαi-lßk
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali ╟ar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_NhΓ.t Th·*_Hai Th·*_Ba Th·*_Tu* Th·*_Na'm Th·*_Sßu Th·*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunµ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_g▄n▄ Bazar_µrtµsi ╟µrs,µnbµ_axs,am≥ ╟µrs,µnbµ_g▄n▄ C▄mµ_axs,am≥ C▄mµ_g▄n▄ C▄mµ_Senbµ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sßbado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiαn xing-_qi-_yi-. xing-_qi-_Φr xing-_qi-_san-. xing-_qi-_s∞ xing-_qi-_wuv. xing-_qi-_li∙
 4  djadomingu djaluna djamars djarason djaweps djabiΦrnΦ djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

C#

using System;
using System.Collections.Generic;

namespace Abbreviations {
    class Program {
        static void Main(string[] args) {
            string[] lines = System.IO.File.ReadAllLines("days_of_week.txt");
            int i = 0;

            foreach (string line in lines) {
                i++;
                if (line.Length > 0) {
                    var days = line.Split();
                    if (days.Length != 7) {
                        throw new Exception("There aren't 7 days in line " + i);
                    }

                    Dictionary<string, int> temp = new Dictionary<string, int>();
                    foreach (string day in days) {
                        if (temp.ContainsKey(day)) {
                            Console.WriteLine(" ∞  {0}", line);
                            continue;
                        }
                        temp.Add(day, 1);
                    }

                    int len = 1;
                    while (true) {
                        temp.Clear();
                        foreach(string day in days) {
                            string key;
                            if (len < day.Length) {
                                key = day.Substring(0, len);
                            } else {
                                key = day;
                            }
                            if (temp.ContainsKey(key)) {
                                break;
                            }
                            temp.Add(key, 1);
                        }
                        if (temp.Count == 7) {
                            Console.WriteLine("{0,2:D}  {1}", len, line);
                            break;
                        }
                        len++;
                    }
                }
            }
        }
    }
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djel‰ E_h‰n‰ E_mart‰ E_m‰rkur‰ E_enjte E_premte E_shtun‰
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes mi‚rcoles xueves vienres s badu
 2  Bazar_gšnš Birinci_gšn €kinci_gšn š‡šncš_gšn D™rdšncš_gšn Bes,inci_gšn Alt•nc•_gšn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi MŠkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^l¡ £ter˜ str^eda c^tvrtek p tek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Ja—do Vendredo Sabato
 1  pšhap„ev esmasp„ev teisip„ev kolmap„ev neljap„ev reede laup„ev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur m nadagur t˜sdaguy mikudagur h¢sdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes M‚rcores Joves Venres S bado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  p¢pule p¢`akahi p¢`alua p¢`akolu p¢`ah  p¢`alima p¢`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vas rnap h‚tf” kedd szerda cs�t”rt”k p‚ntek szombat
 2  Sunnudagur M nudagur Æriëjudagur Miëvikudagar Fimmtudagur F™studagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  D‚_Domhnaigh D‚_Luain D‚_M irt D‚_Ceadaoin D‚_ardaoin D‚_hAoine D‚_Sathairn
 2  domenica luned¡ marted¡ mercoled¡ gioved¡ venerd¡ sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lun‘ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_r� xing-_qi-_yi-. xing-_qi-_Šr xing-_qi-_san-. xing-_qi-_s� xing-_qi-_wuv. xing-_qi-_li—
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo min•mishi m rtes miŠrkoles misheushi bŠrnashi mish baro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  síndag mandag tirsdag onsdag torsdag fredag lírdag
 7  lo_dimenge lo_diluns lo_dimar‡ lo_dimŠrcres lo_dij•us lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabiŠrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire ter‡a-feire quarta-feire quinta-feire sexta-feira s†bado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminic¦ Luni Mart'i Miercuri Joi Vineri Sƒmb¦t¦
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-m…irt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes mi‚rcoles jueves viernes s bado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  s”ndag m†ndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  L‚-p…i-j¡t P…i-it P…i-j‹ P…i-sa¤ P…i-s� P…i-g™. P…i-l k
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali €ar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_Nhƒ.t Th£*_Hai Th£*_Ba Th£*_Tu* Th£*_Na'm Th£*_S u Th£*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lun‘ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_gšnš Bazar_‘rt‘si €‘rs,‘nb‘_axs,am• €‘rs,‘nb‘_gšnš Cšm‘_axs,am• Cšm‘_gšnš Cšm‘_Senb‘
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres S bado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_ti…n xing-_qi-_yi-. xing-_qi-_Šr xing-_qi-_san-. xing-_qi-_s� xing-_qi-_wuv. xing-_qi-_li—
 4  djadomingu djaluna djamars djarason djaweps djabiŠrnŠ djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

C++

Translation of: C#
#include <iomanip>
#include <iostream>
#include <fstream>
#include <map>
#include <sstream>
#include <string>
#include <vector>

std::vector<std::string> split(const std::string& str, char delimiter) {
    std::vector<std::string> tokens;
    std::string token;
    std::istringstream tokenStream(str);
    while (std::getline(tokenStream, token, delimiter)) {
        tokens.push_back(token);
    }
    return tokens;
}

int main() {
    using namespace std;
    string line;
    int i = 0;

    ifstream in("days_of_week.txt");
    if (in.is_open()) {
        while (getline(in, line)) {
            i++;
            if (line.empty()) {
                continue;
            }

            auto days = split(line, ' ');
            if (days.size() != 7) {
                throw std::runtime_error("There aren't 7 days in line " + i);
            }

            map<string, int> temp;
            for (auto& day : days) {
                if (temp.find(day) != temp.end()) {
                    cerr << " ∞  " << line << '\n';
                    continue;
                }
                temp[day] = 1;
            }

            int len = 1;
            while (true) {
                temp.clear();
                for (auto& day : days) {
                    string key = day.substr(0, len);
                    if (temp.find(key) != temp.end()) {
                        break;
                    }
                    temp[key] = 1;
                }
                if (temp.size() == 7) {
                    cout << setw(2) << len << "  " << line << '\n';
                    break;
                }
                len++;
            }
        }
    }

    return 0;
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miércoles xueves vienres sábadu
 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 7  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 5  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miércoles jueves viernes sábado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  söndag måndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 7  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 9  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
15  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

COBOL

Works with: GnuCOBOL version 3.1.2.0
            IDENTIFICATION DIVISION.
            PROGRAM-ID. AUTO-ABBREVIATIONS.

            ENVIRONMENT DIVISION.

            INPUT-OUTPUT SECTION.
            FILE-CONTROL.
              SELECT DOW ASSIGN TO "days-of-week.txt"
              ORGANIZATION IS LINE SEQUENTIAL.

            DATA DIVISION.
              FILE SECTION.
              FD DOW.
              01 DOW-FILE PIC X(200).

              WORKING-STORAGE SECTION. *> a.k.a. variables
              01 DOW-LINE PIC X(200).
              01 ENDO PIC 9(1).
              01 ENDO2 PIC 9(1).
              01 CURDAY PIC X(50).
              01 ABPTR PIC 999.
              01 LINE-NUM PIC 9(3) VALUE 1.
              01 CHARAMT PIC 9(3) VALUE 1.
              01 LARGESTCHARAMT PIC 9(3).
              01 DAYNUM PIC 9(3) VALUE 1.
              01 ABRESTART PIC 9(1).
              01 CURABBR PIC X(50).
              01 TMP1 PIC 9(3).
              01 TMP2 PIC 9(3).
              01 TINDEX PIC 9(3) VALUE 1.
              01 ABBRLIST.
                05 ABBRITEM PIC X(50) OCCURS 7 TIMES.
              

            PROCEDURE DIVISION.
              OPEN INPUT DOW.
                PERFORM UNTIL ENDO = 1
                  READ DOW INTO DOW-LINE
                    AT END MOVE 1 TO ENDO
                    NOT AT END PERFORM
                      *> loop through each line
                      IF DOW-LINE = "" THEN
                        DISPLAY ""
                      ELSE
                        MOVE 0 TO ENDO2
                        MOVE 0 TO CHARAMT

                        PERFORM UNTIL ENDO2 > 0
                          MOVE 1 TO ABPTR
                          MOVE 1 TO DAYNUM
                          MOVE 0 TO ABRESTART

                          ADD 1 TO CHARAMT

                          *> reset the abbreviation table
                          MOVE 1 TO TINDEX
                          PERFORM 7 TIMES
                            MOVE SPACE TO ABBRITEM(TINDEX)
                            ADD 1 TO TINDEX
                          END-PERFORM

                          *> loop through each day
                          PERFORM 7 TIMES
                            UNSTRING DOW-LINE DELIMITED BY SPACE
                              INTO CURDAY
                              WITH POINTER ABPTR
                            END-UNSTRING

                            MOVE 0 TO TMP1
                            MOVE 0 TO TMP2
                            INSPECT CURDAY
                              TALLYING TMP1 FOR ALL CHARACTERS
                            INSPECT CURDAY
                              TALLYING TMP2 FOR ALL SPACE
                            SUBTRACT TMP2 FROM TMP1
                            IF TMP1 > LARGESTCHARAMT THEN
                              MOVE TMP1 TO LARGESTCHARAMT
                            END-IF

                            *> not enough days error
                            IF CURDAY = "" THEN
                              MOVE 3 TO ENDO2
                            END-IF

                            MOVE CURDAY(1:CHARAMT) TO CURABBR

                            *> check if the current abbreviation is already taken
                            MOVE 1 TO TINDEX
                            PERFORM 7 TIMES
                              IF ABBRITEM(TINDEX) = CURABBR THEN
                                MOVE 1 TO ABRESTART
                              END-IF
                              ADD 1 TO TINDEX
                            END-PERFORM

                            MOVE CURABBR TO ABBRITEM(DAYNUM)

                            ADD 1 TO DAYNUM

                          END-PERFORM

                          IF ABRESTART = 0 THEN
                            MOVE 1 TO ENDO2
                          END-IF

                          *> identical days error
                          IF CHARAMT > LARGESTCHARAMT THEN
                            MOVE 2 TO ENDO2
                          END-IF

                        END-PERFORM

                        DISPLAY "Line " LINE-NUM ": " WITH NO ADVANCING

                        IF ENDO2 = 3 THEN
                          DISPLAY "Error: not enough " WITH NO ADVANCING
                          DISPLAY "days"
                        ELSE IF ENDO2 = 2 THEN
                          DISPLAY "Error: identical " WITH NO ADVANCING
                          DISPLAY "days"
                        ELSE
                          DISPLAY CHARAMT ": " WITH NO ADVANCING

                          *> loop through each day and display its abbreviation
                          MOVE 1 TO TINDEX
                          PERFORM 7 TIMES
                            MOVE ABBRITEM(TINDEX) TO CURABBR

                            MOVE 0 TO TMP1
                            MOVE 0 TO TMP2
                            INSPECT CURABBR
                              TALLYING TMP1 FOR ALL CHARACTERS
                            INSPECT CURABBR
                              TALLYING TMP2 FOR TRAILING SPACES
                            SUBTRACT TMP2 FROM TMP1

                            DISPLAY CURABBR(1:TMP1) WITH NO ADVANCING
                            DISPLAY "." WITH NO ADVANCING

                            IF TINDEX < 7 THEN
                              DISPLAY SPACE WITH NO ADVANCING
                            ELSE
                              DISPLAY X"0a" WITH NO ADVANCING *> go to next line
                            END-IF

                            ADD 1 TO TINDEX
                          END-PERFORM
                        END-IF

                      END-IF

                    END-PERFORM
                  END-READ

                  ADD 1 TO LINE-NUM
                END-PERFORM.
              CLOSE DOW.
              STOP RUN.
Output:
auto-abbreviations.cbl:42: warning: alphanumeric literal has zero length; a SPACE will be assumed [-Wothers]
auto-abbreviations.cbl:43: warning: alphanumeric literal has zero length; a SPACE will be assumed [-Wothers]
auto-abbreviations.cbl:81: warning: alphanumeric literal has zero length; a SPACE will be assumed [-Wothers]
Line 001: 002: Su. Mo. Tu. We. Th. Fr. Sa.
Line 002: 002: So. Ma. Di. Wo. Do. Vr. Sa.
Line 003: 004: E_dj. E_h?. E_ma. E_m?. E_en. E_pr. E_sh.
Line 004: 002: Eh. Se. Ma. Er. Ha. Ar. Ke.
Line 005: 005: Al_Ah. Al_It. Al_Th. Al_Ar. Al_Ka. Al_Go. Al_Sa.
Line 006: 004: Guir. Yerg. Yere. Tcho. Hink. Ourp. Shap.
Line 007: 002: do. ll. ma. mi. xu. vi. s?.
Line 008: 002: Ba. Bi. Ç. Ü. D?. Be. Al.
Line 009: 006: Igande. Astele. Astear. Asteaz. Ostegu. Ostira. Larunb.
Line 010: 004: Robi. Shom. Mong. Budh. BRih. Shuk. Shon.
Line 011: 002: Ne. Po. Ut. Sr. Cx. Pe. Su.
Line 012: 005: Disul. Dilun. Dimeu. Dimer. Diria. Digwe. Disad.
Line 013: 002: ne. po. vt. sr. ch. pe. sa.
Line 014: 012: sing_kei_yah. sing_kei_yat. sing_kei_yee. sing_kei_saa. sing_kei_sie. sing_kei_ng. sing_kei_luk.
Line 015: 004: Dium. Dill. Dima. Dime. Dijo. Dive. Diss.
Line 016: 016: Dzeenkk-eh. Dzeehn_kk-ehreh. Dzeehn_kk-ehreh_. Tah_neesee_dzeeh. Deehn_ghee_dzee-. Tl-oowey_tts-el_. Dzeentt-ahzee.
Line 017: 006: dy_Sul. dy_Lun. dy_Meu. dy_Mer. dy_You. dy_Gwe. dy_Sad.
Line 018: 002: Di. Le. Ma. M?. Je. Va. Sa.
Line 019: 002: ne. po. ut. sr. cx. pe. su.
Line 020: 002: ne. po. ú. st. c^. p?. so.
Line 021: 002: So. Mo. Ti. Wa. TO. Fe. Sa.
Line 022: 002: s0. ma. ti. on. to. fr. l0.
Line 023: 002: zo. ma. di. wo. do. vr. za.
Line 024: 002: Di. Lu. Ma. Me. ^J. Ve. Sa.
Line 025: 001: p. e. t. k. n. r. l.
 
Line 027: 007: Diu_pri. Diu_seq. Diu_tri. Diu_qua. Diu_qui. Diu_sex. Diu_sab.
Line 028: 002: su. m?. t?. mi. h?. fr. le.
Line 029: 002: Ye. Do. Se. Ch. Pa. Jo. Sh.
Line 030: 002: su. ma. ti. ke. to. pe. la.
Line 031: 002: di. lu. ma. me. je. ve. sa.
Line 032: 004: Snei. Moan. Tiis. Woan. Tone. Free. Sneo.
Line 033: 002: Do. Se. Ma. M?. Jo. Ve. S?.
Line 034: 002: k'. or. sa. ot. kh. p'. sh.
Line 035: 002: So. Mo. Di. Mi. Do. Fr. Sa.
Line 036: 002: Ki. De. Tr. Te. Pe. Pa. Sa.
Line 037: 003: rav. som. man. bud. gur. shu. sha.
Line 038: 007: pópule. pó`aka. pó`alu. pó`ako. pó`ah?. pó`ali. pó`aon.
Line 039: 007: Yom_ris. Yom_she. Yom_shl. Yom_rev. Yom_cha. Yom_shi. Shabat.
Line 040: 003: rav. som. man. bud. bra. shu. sha.
Line 041: 003: vas. hé. ked. sze. cs?. pé. szo.
Line 042: 002: Su. M?. ?. Mi. Fi. F?. La.
Line 043: 002: su. lu. ma. me. jo. ve. sa.
Line 044: 003: Min. Sen. Sel. Rab. Kam. Jum. Sab.
Line 045: 002: Do. Lu. Ma. Me. Jo. Ve. Sa.
Line 046: 005: Dé_D. Dé_L. Dé_M. Dé_C. Dé_a. Dé_h. Dé_S.
Line 047: 002: do. lu. ma. me. gi. ve. sa.
Line 048: 002: Ni. Ge. Ka. Su. Mo. Ki. Do.
Line 049: 001: I. W. H. S. M. K. T.
Line 050: 007: Dies_Do. Dies_Lu. Dies_Ma. Dies_Me. Dies_Io. Dies_Ve. Dies_Sa.
Line 051: 003: sve. pir. otr. tre. cet. pie. ses.
Line 052: 002: Se. Pi. An. Tr. Ke. Pe. S^.
Line 053: 003: Wan. Kaz. Wal. Muk. Kiw. Nna. Wam.
Line 054: 012: xing-_qi-_r?. xing-_qi-_yi. xing-_qi-_è. xing-_qi-_sa. xing-_qi-_s?. xing-_qi-_wu. xing-_qi-_li.
Line 055: 003: Jed. Jel. Jem. Jec. Jar. Jeh. Jes.
Line 056: 003: Jab. Man. Juj. Won. Tai. Bal. Jar.
Line 057: 005: gemin. minò. márt. mièr. mishe. bèrn. mish?.
Line 058: 002: Ah. Is. Se. Ra. Kh. Ju. Sa.
Line 059: 002: s?. ma. ti. on. to. fr. l?.
Line 060: 007: lo_dime. lo_dilu. lo_dima. lo_dim?. lo_dij?. lo_dive. lo_diss.
Line 061: 004: djad. djal. djam. djar. djaw. djab. djas.
Line 062: 002: Ni. Po. Wt. S,. Cz. Pi. So.
Line 063: 003: Dom. seg. ter. qua. qui. sex. så.
Line 064: 001: D. L. m. M. J. V. S.
Line 065: 002: Du. Lu. Ma. Mi. Jo. Vi. S?.
Line 066: 002: vo. po. vt. sr. ch. py. su.
Line 067: 004: Sund. Di-l. Di-m. Di-c. Di-a. Di-h. Di-s.
Line 068: 002: ne. po. ut. sr. cx. pe. su.
Line 069: 005: Sonta. Mmant. Labob. Labor. Labon. Laboh. Moqeb.
Line 070: 002: Ir. Sa. An. Ba. Br. Si. Se.
Line 071: 002: ne. po. ut. st. s^. pi. so.
Line 072: 002: Ne. Po. To. Sr. Cx. Pe. So.
Line 073: 002: do. lu. ma. mi. ju. vi. s?.
Line 074: 002: so. mu. tu. dr. fo. fr. Sa.
Line 075: 007: Jumapil. Jumatat. Jumanne. Jumatan. Alhamis. Ijumaa. Jumamos.
Line 076: 002: s?. m?. ti. on. to. fr. lo.
Line 077: 002: Li. Lu. Ma. Mi. Hu. Bi. Sa.
Line 078: 007: Lé-pà. Pài-it. Pài-j?. Pài-sa. Pài-s?. Pài-g?. Pài-l?.
Line 079: 007: wan-ar-. wan-tja. wan-ang. wan-pho. wan-pha. wan-soo. wan-sao.
Line 080: 005: Tship. Mosup. Labob. Labor. Labon. Labot. Matlh.
Line 081: 006: Pazar. Pazart. Sali. Çar,s. Per,se. Cuma. Cumart.
Line 082: 002: ne. po. vi. se. ch. py. su.
Line 083: 009: Chu?_Nhâ. Thú*_Hai. Thú*_Ba. Thú*_Tu*. Thú*_Na'. Thú*_Sá. Thú*_Ba?.
Line 084: 006: dydd_S. dyds_L. dydd_M. dyds_M. dydd_I. dydd_G. dyds_S.
Line 085: 003: Dib. Alt. Tal. All. Al_. Alj. Gaa.
Line 086: 007: iCawa. uMvulo. uLwesib. uLwesit. uLuwesi. uLwesih. uMgqibe.
Line 087: 002: zu. mo. di. mi. do. fr. sh.
Line 088: 007: iSonto. uMsombu. uLwesib. uLwesit. uLwesin. uLwesih. uMgqibe.
Line 089: 007: Dies_Do. Dies_Lu. Dies_Ma. Dies_Me. Dies_Io. Dies_Ve. Dies_Sa.
Line 090: 015: Bazar_gÜnÜ. Bazar_ærtæsi. Çærs,ænbæ_a. Çærs,ænbæ_g. CÜmæ_axs,amò. CÜmæ_gÜnÜ. CÜmæ_Senbæ.
Line 091: 002: Su. Mo. Ma. Me. Jo. Ve. Sa.
Line 092: 002: zo. ma. di. wo. do. vr. za.
Line 093: 002: Ko. Gy. Be. Ku. YO. Fe. Me.
Line 094: 005: Sonnt. Monta. Diens. Mittw. Donne. Freit. Sonna.
Line 095: 001: D. L. T. C. X. V. S.
Line 096: 007: Dies_So. Dies_Lu. Dies_Ma. Dies_Me. Dies_Io. Dies_Ve. Dies_Sa.
Line 097: 012: xing-_qi-_ti. xing-_qi-_yi. xing-_qi-_è. xing-_qi-_sa. xing-_qi-_s?. xing-_qi-_wu. xing-_qi-_li.
Line 098: 004: djad. djal. djam. djar. djaw. djab. djas.
Line 099: 002: Ki. At. Qu. Il. Ch. Ku. In.

Common Lisp

It uses the standard library split-sequence to split the string into words.

(defun max-mismatch (list)
  (if (cdr list)
    (max (apply #'max (mapcar #'(lambda (w2) (mismatch (car list) w2)) (cdr list))) (max-mismatch (cdr list)))
    0 ))

(with-open-file (f "days-of-the-week.txt" :direction :input)
  (do* ((row (read-line f nil nil) (read-line f nil nil)))
       ((null row) t)
    (format t "~d ~a~%" (1+ (max-mismatch (SPLIT-SEQUENCE:split-sequence #\Space row))) row) ))
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
1 
7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau
T

D

Translation of: Kotlin
import std.conv;
import std.exception;
import std.range;
import std.stdio;
import std.string;

void main() {
    foreach (size_t i, dstring line; File("days_of_week.txt").lines) {
        line = chomp(line);
        if (!line.empty) {
            auto days = line.split;
            enforce(days.length==7, text("There aren't 7 days in line ", i+1));

            int[dstring] temp;
            foreach(day; days) {
                temp[day]++;
            }
            if (days.length < 7) {
                writeln(" ∞  ", line);
                continue;
            }
            int len = 1;
            while (true) {
                temp.clear();
                foreach (day; days) {
                    temp[day.take(len).array]++;
                }
                if (temp.length == 7) {
                    writefln("%2d  %s", len, line);
                    break;
                }
                len++;
            }
        }
    }
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miércoles xueves vienres sábadu
 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miércoles jueves viernes sábado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  söndag måndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Delphi

This example does not show the output mentioned in the task description on this page (or a page linked to from here). Please ensure that it meets all task requirements and remove this message.
Note that phrases in task descriptions such as "print and display" and "print and show" for example, indicate that (reasonable length) output be a part of a language's solution.


Translation of: Kotlin
program Abbreviations_Automatic;

{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  System.Generics.Collections,
  System.IOUtils;

function DistinctStrings(strs: TArray<string>): TArray<string>;
begin
  var l := length(strs);
  var _set := TDictionary<string, Boolean>.Create;
  SetLength(result, 0);
  for var str in strs do
  begin
    if not _set.ContainsKey(str) then
    begin
      SetLength(result, Length(result) + 1);
      result[High(result)] := str;
      _set.AddOrSetValue(str, true);
    end;
  end;
  _set.free;
end;

function takeRunes(s: string; n: Integer): string;
begin
  var i := 0;
  for var j := 0 to s.Length - 1 do
  begin
    if i = n then
      exit(s.Substring(0, j));
    inc(i);
  end;
  Result := s;
end;

begin
  var lines := TFile.ReadAllLines('days_of_week.txt');

  var lineCount := 0;
  while lineCount < length(Lines) do
  begin
    var line := lines[lineCount].Trim;
    inc(lineCount);
    if line.IsEmpty then
    begin
      Writeln;
      Continue;
    end;

    var days := line.Split([' '], TStringSplitOptions.ExcludeEmpty);
    var daysLen := Length(days);
    if daysLen <> 7 then
    begin
      Writeln('There aren''t 7 days in line', lineCount);
      Readln;
      halt;
    end;

    if Length(distinctStrings(days)) <> 7 then
    begin
      writeln(' infinity ', line);
      Continue;
    end;

    var abbrevLen := 0;
    while True do
    begin
      var abbrevs: TArray<string>;
      SetLength(abbrevs, daysLen);

      for var i := 0 to daysLen - 1 do
        abbrevs[i] := takeRunes(days[i], abbrevLen);

      if Length(distinctStrings(abbrevs)) = 7 then
      begin
        Writeln(abbrevLen.ToString.PadLeft(2).PadRight(3), line);
        Break;
      end;

      inc(abbrevLen);
    end;

  end;
  Readln;
end.

Emacs Lisp

(defun abbreviate-list (list-of-days abbreviation-length)
  "Take each element of LIST-OF-DAYS and abbreviate to ABBREVIATION-LENGTH."
  (let ((abbrev-list)
        (abbrev-element))
    (dolist (one-element list-of-days)                                        ; loop through each day of week
;; if the day of week is at least as long as the abbreviation      
      (if (>= (length one-element) abbreviation-length)                       ; if day >= abbreviation length
          (setq abbrev-element (substring one-element 0 abbreviation-length)) ; abbreviate the day of the week
        (setq abbrev-element one-element))                                    ; otherwise don't abbreviate
      (push abbrev-element abbrev-list))                                      ; put the abbreviated/non-abbreviated day on our list
    abbrev-list))                                                             ; return the list of abbreviated days

(defun cycle-days (list-of-days)
  "Find shortest unique abbreviation in LIST-OF-DAYS list."
  (let ((abbrev-list)
        (abbrev-length 1)
        (current-abbrev)
        (looking-for-shortest-list t))
    (if (= (length list-of-days) 0)                                   ; if list-of-days is empty (i.e., blank line)
        (setq looking-for-shortest-list nil))                         ; then don't look for the shortest unique abbreviations
    (while looking-for-shortest-list                                  ; as long as we are looking for the shortest unique abbreviations
      (setq abbrev-list (abbreviate-list list-of-days abbrev-length)) ; get a list of abbreviated day names
      (if (= (length list-of-days) (length (seq-uniq abbrev-list)))   ; if abbreviated list has no duplicates
          (progn 
            (message (format "%d %s" abbrev-length list-of-days))     ; then in echo buffer show length and days
            (setq looking-for-shortest-list nil))                     ; also, then don't look for the shortest unique abbreviations
        (setq abbrev-length (+ abbrev-length 1))))))                  ; else increase the length of the abbreviation; loop to while

(defun days-of-week ()
  "Find minimum abbreviation length of days of week."
  (let ((current-line-list))
  (find-file "Days_of_week.txt")                             ; open file or switch to buffer
  (beginning-of-buffer)                                      ; go to the top of the buffer
  (dolist (current-line (split-string (buffer-string) "\n")) ; go line by line through buffer
    (setq current-line-list (split-string current-line " ")) ; change each line into list of days of week
    (cycle-days current-line-list))))
Output:

(days-of-week)

2 (Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
2 (Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag)
4 (E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë)
2 (Ehud Segno Maksegno Erob Hamus Arbe Kedame)
5 (Al_Ahad Al_Ithinin Al_Tholatha’a Al_Arbia’a Al_Kamis Al_Gomia’a Al_Sabit)
4 (Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat)
2 (domingu llunes martes miércoles xueves vienres sábadu)
2 (Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn)
6 (Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat)
4 (Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar)
2 (Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota)
5 (Disul Dilun Dimeurzh Dimerc’her Diriaou Digwener Disadorn)
2 (nedelia ponedelnik vtornik sriada chetvartak petak sabota)
12 (sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk)
4 (Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte)
16 (Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee)
6 (dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn)
2 (Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi)
2 (nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota)
2 (nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota)
2 (Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee)
2 (s0ndag mandag tirsdag onsdag torsdag fredag l0rdag)
2 (zondag maandag dinsdag woensdag donderdag vrijdag zaterdag)
2 (Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato)
1 (pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev)
1 ()
7 (Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata)
2 (sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur)
2 (Yek_Sham’beh Do_Sham’beh Seh_Sham’beh Cha’har_Sham’beh Panj_Sham’beh Jom’eh Sham’beh)
2 (sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai)
2 (dimanche lundi mardi mercredi jeudi vendredi samedi)
4 (Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon)
2 (Domingo Segunda_feira Martes Mércores Joves Venres Sábado)
2 (k’vira orshabati samshabati otkhshabati khutshabati p’arask’evi shabati)
2 (Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag)
2 (Kiriaki’ Defte’ra Tri’ti Teta’rti Pe’mpti Paraskebi’ Sa’bato)
3 (ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar)
6 (pópule pó‘akahi pó‘alua pó‘akolu pó‘ahá pó‘alima pó‘aono)
7 (Yom_rishon Yom_sheni Yom_shlishi Yom_revi’i Yom_chamishi Yom_shishi Shabat)
3 (ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar)
3 (vasárnap hétfö kedd szerda csütörtök péntek szombat)
2 (Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur)
2 (sundio lundio mardio merkurdio jovdio venerdio saturdio)
3 (Minggu Senin Selasa Rabu Kamis Jumat Sabtu)
2 (Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato)
4 (Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn)
2 (domenica lunedí martedí mercoledí giovedí venerdí sabato)
2 (Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin’you_bi Doyou_bi)
1 (Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il)
7 (Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni)
3 (sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien)
2 (Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis)
3 (Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi)
12 (xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù)
3 (Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam)
3 (Jabot Manre Juje Wonje Taije Balaire Jarere)
5 (geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro)
2 (Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu)
2 (sφndag mandag tirsdag onsdag torsdag fredag lφrdag)
7 (lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte)
4 (djadomingo djaluna djamars djarason djaweps djabièrna djasabra)
2 (Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota)
3 (Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado)
1 (Domingo Lunes martes Miercoles Jueves Viernes Sabado)
2 (Duminicª Luni Mart’i Miercuri Joi Vineri Sâmbªtª)
2 (voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota)
4 (Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne)
2 (nedjelja ponedjeljak utorak sreda cxetvrtak petak subota)
5 (Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo)
2 (Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-)
2 (nedel^a pondelok utorok streda s^tvrtok piatok sobota)
2 (Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota)
2 (domingo lunes martes miércoles jueves viernes sábado)
2 (sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday)
7 (Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi)
2 (söndag måndag tisdag onsdag torsdag fredag lordag)
2 (Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado)
6 (Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák)
7 (wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao)
5 (Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso)
6 (Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi)
2 (nedilya ponedilok vivtorok sereda chetver pyatnytsya subota)
8 (Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na’m Thú*_Sáu Thú*_Ba?y)
6 (dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn)
3 (Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw)
7 (iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo)
2 (zuntik montik dinstik mitvokh donershtik fraytik shabes)
7 (iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo)
7 (Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni)
11 (Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ)
2 (Sun Moon Mars Mercury Jove Venus Saturn)
2 (zondag maandag dinsdag woensdag donderdag vrijdag zaterdag)
2 (KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa)
5 (Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend)
1 (Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado)
7 (Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum)
12 (xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù)
4 (djadomingu djaluna djamars djarason djaweps djabièrnè djasabra)
2 (Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau)
1 ()
nil


Erlang

This example uses a byproduct of turning a list into a set. Only the unique elements are added to the set.

The output is of the set of abbreviations. These are not sorted correctly and some encoding errors remain.

-module(abbreviateweekdays).
-export([ main/0 ]).


uniq(L,Acc) ->
    io:fwrite("Min = ~p",[Acc]),
    io:fwrite(" Abbr:~p~n",[ sets:to_list(L) ]).

uniq(_, L, Acc) ->
    Abbr = [string:substr(X,1,Acc) || X <- L],
    %  list of abbrevs, starting with substring 1,1:
    TempSet = sets:from_list( Abbr ),
    TempSize = sets:size(TempSet),
    if 
      TempSize =:= 7 -> 
        uniq(TempSet,Acc);
      true  -> uniq(0, L, Acc+1)
     end.

read_lines(Device, Acc) when Acc < 19 -> 
   case file:read_line(Device) of
    {ok, Line} ->
      Tokenized = string:tokens(Line," "),
      uniq(0,Tokenized,1),
      read_lines(Device, Acc + 1);
     eof ->
       io:fwrite("~p~n",["Done"])
    end;

read_lines(Device, 19) -> 
       io:fwrite("~p~n",["Done"]).
    

main() ->
  {ok, Device} = (file:open("weekdays.txt", read)),
  read_lines(Device, 1).
Output:
40> c(abbreviateweekdays).
abbreviateweekdays.erl:28: Warning: variable 'Device' is unused
{ok,abbreviateweekdays}
41> abbreviateweekdays:main().
Min = 2 Abbr:["Th","Sa","Tu","Su","Mo","We","Fr"]
Min = 2 Abbr:["Sa","Ma","Do","Di","So","Wo","Vr"]
Min = 4 Abbr:["E_ma","E_sh","E_dj","E_hÃ","E_en","E_mÃ","E_pr"]
Min = 2 Abbr:["Eh","Er","Ha","Ma","Se","Ar","Ke"]
Min = 5 Abbr:["Al_Ka","Al_Ah","Al_Go","Al_Ar","Al_It","Al_Th","Al_Sa"]
Min = 4 Abbr:["Yerg","Shap","Yere","Hink","Guir","Tcho","Ourp"]
Min = 2 Abbr:["vi","ma","do","xu","mi","sÃ","ll"]
Min = 2 Abbr:["Al",[195,135],"Ba",[195,156],"DÃ","Be","Bi"]
Min = 6 Abbr:["Astele","Astear","Ostira","Ostegu","Larunb","Igande","Asteaz"]
Min = 4 Abbr:["Robi","Mong","Budh","BRih","Shom","Shuk","Shon"]
Min = 2 Abbr:["Pe","Po","Ne","Cx","Su","Sr","Ut"]
Min = 5 Abbr:["Disad","Dilun","Diria","Digwe","Dimeu","Disul","Dimer"]
Min = 2 Abbr:["pe","po","sa","ne","ch","sr","vt"]
Min = 12 Abbr:["sing_kei_saa","sing_kei_yah","sing_kei_luk","sing_kei_yee",
       "sing_kei_ng","sing_kei_sie","sing_kei_yat"]
Min = 4 Abbr:["Dill","Dijo","Dima","Dium","Dime","Diss","Dive"]
Min = 16 Abbr:["Tl-oowey_tts-el_","Dzeehn_kk-ehreh","Tah_neesee_dzeeh",
       "Dzeentt-ahzee\n","Dzeenkk-eh","Dzeehn_kk-ehreh_","Deehn_ghee_dzee-"]
Min = 6 Abbr:["dy_Gwe","dy_You","dy_Meu","dy_Sul","dy_Mer","dy_Sad","dy_Lun"]
Min = 2 Abbr:["Je","Sa","Ma","Di","Va","Le","MÃ"]
"Done"
ok

F#

The function

let fN g=let rec fN n=if g|>List.map(fun(g:string)->g.[0..n])|>Set.ofList|>Set.count=(List.length g) then (n+1) else fN(n+1)
         fN 0

The Task - Demonstrate the function

fN ["Sunday"; "Monday"; "Tuesday"; "Wednesday"; "Thursday"; "Friday"; "Saturday"]                  // -> 2
fN ["Sondag"; "Maandag"; "Dinsdag"; "Woensdag"; "Donderdag"; "Vrydag"; "Saterdag"]                 // -> 2
fN ["E_djelë"; "E_hënë"; "E_martë"; "E_mërkurë"; "E_enjte"; "E_premte"; "E_shtunë"]                // -> 4
fN ["Ehud"; "Segno"; "Maksegno"; "Erob"; "Hamus"; "Arbe"; "Kedame"]                                // -> 2
fN ["Al_Ahad"; "Al_Ithinin"; "Al_Tholatha'a"; "Al_Arbia'a"; "Al_Kamis"; "Al_Gomia'a"; "Al_Sabit";] // -> 5

Factor

Part of Factor's philosophy is to write extremely short words (functions). As a guideline, words should usually fit on one to three 64-column lines unless they use cond or contain a large literal. If you find yourself writing a word longer than that, it's time to factor!

As a concatenative language, Factor is uniquely suited for factoring words into smaller words. Assuming lexical/dynamic variables are not used, factoring is a cut-and-paste job that can be performed almost anywhere there is whitespace.

USING: formatting io io.encodings.utf8 io.files kernel math
sequences sets splitting ;
IN: rosetta-code.abbreviations-automatic

: map-head ( seq n -- seq' ) [ short head ] curry map ;

: unique? ( seq n -- ? ) map-head all-unique? ;
    
: (abbr-length) ( seq -- n )
    1 [ 2dup unique? ] [ 1 + ] until nip ;

: abbr-length ( str -- n/str )
    [ "" ] [ " " split (abbr-length) ] if-empty ;

: show ( str -- ) dup abbr-length swap " %2u  %s\n" printf ;

: labels ( -- )
    "Min." "abbr" "Days of the week" "%s\n%s%32s\n" printf ;

: line ( n -- ) [ "=" write ] times ;

: header ( -- ) labels 4 line bl 75 line nl ;

: body ( -- ) [ show ] each-line ;

: abbreviations ( -- )
    header "day-names.txt" utf8 [ body ] with-file-reader ;

MAIN: abbreviations
Output:
Min.
abbr                Days of the week
==== ===========================================================================
  2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
  2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
  4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
  2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
  5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
  4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
  2  domingu llunes martes miércoles xueves vienres sábadu
  2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
  6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
  4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
  2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
  5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
  2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
 12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
  4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
 16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
  6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
  2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
  2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
  2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
  2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
  2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
  2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
  2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
  1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 ""  
  7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
  2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
  2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
  2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
  2  dimanche lundi mardi mercredi jeudi vendredi samedi
  4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
  2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
  2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
  2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
  2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
  3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
  6  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
  7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
  3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
  3  vasárnap hétfö kedd szerda csütörtök péntek szombat
  2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
  2  sundio lundio mardio merkurdio jovdio venerdio saturdio
  3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
  2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
  4  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
  2  domenica lunedí martedí mercoledí giovedí venerdí sabato
  2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
  1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
  7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
  3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
  2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
  3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
 12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
  3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
  3  Jabot Manre Juje Wonje Taije Balaire Jarere
  5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
  2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
  2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
  7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
  4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
  2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
  3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
  1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
  2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
  2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
  4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
  2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
  5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
  2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
  2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
  2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
  2  domingo lunes martes miércoles jueves viernes sábado
  2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
  7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
  2  söndag måndag tisdag onsdag torsdag fredag lordag
  2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
  6  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
  7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
  5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
  6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
  2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
  8  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
  6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
  3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
  7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
  2  zuntik montik dinstik mitvokh donershtik fraytik shabes
  7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
  7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 11  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
  2  Sun Moon Mars Mercury Jove Venus Saturn
  2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
  2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
  5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
  1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
  7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
 12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
  4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
  2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

FreeBASIC

Translation of: Yabasic
Function Tokenize(text As String, tokens() As String) As Integer
    Dim As Integer count = 0, posic = 1, start
    
    While posic <= Len(text)
        If Mid(text, posic, 1) <> " " Then
            start = posic
            While posic <= Len(text) Andalso Mid(text, posic, 1) <> " "
                posic += 1
            Wend
            count += 1
            tokens(count) = Mid(text, start, posic - start)
        End If
        posic += 1
    Wend
    Return count
End Function

Function Buscar(s As String) As Integer
    Dim As Integer n, d, i, j
    Dim As Boolean s_flag
    Dim As String a, b
    Dim As String r(1 To 100) ' Assuming a maximum of 100 tokens
    
    n = Tokenize(s, r())
    d = 1
    
    Do
        s_flag = True
        For i = 1 To n
            For j = i + 1 To n
                a = Left(r(i), d)
                b = Left(r(j), d)
                If a = "" Or b = "" Then
                    s_flag = True
                    Exit For
                Elseif a = b Then
                    s_flag = False
                    d += 1
                    Exit For
                End If
            Next j
            If Not s_flag Then Exit For
        Next i
    Loop Until s_flag
    Return d
End Function

Dim As Integer fileNum = Freefile()
If Open("days_of_week.txt" For Input As #fileNum) = 0 Then
    Dim As String s
    While Not Eof(fileNum)
        Line Input #fileNum, s
        Print Buscar(s); " "; s
    Wend
    Close #fileNum
Else
    Print "Error opening file."
End If

Sleep

FutureBasic

This assumes a text file named "DaysOfWeek.txt" is in the same folder as the code file.

include "NSLog.incl"
include resources "DaysOfWeek.txt"

local fn DaysOfWeek as CFArrayRef
  CFURLRef    url
  CFStringRef string
  CFArrayRef  weeks = NULL
  
  url = fn BundleURLForResource( fn BundleMain, @"DaysOfWeek", @"txt", NULL )
  string = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL )
  if ( string )
    weeks = fn StringComponentsSeparatedByCharactersInSet( string, fn CharacterSetNewlineSet )
  end if
end fn = weeks

local fn MinAbbreviationLength( week as CFStringRef ) as long
  CFArrayRef  days
  CFStringRef day1, day2, abbr
  long        count, length, minLen, index1, index2
  
  minLen = 1
  days = fn StringComponentsSeparatedByString( week, @" " )
  if ( len( days ) == 7 )
    count = len( days )
    for index1 = 0 to count - 1
      day1 = days[index1]
      length = len( day1 )
      abbr = left( day1, minLen )
      for index2 = 0 to count - 1
        if ( index2 == index1 ) then continue
        day2 = days[index2]
        while ( fn StringHasPrefix( day2, abbr ) )
          minLen++
          if ( minLen > length ) then break
          abbr = left( day1, minLen )
        wend
      next
    next
  end if
end fn = minLen

void local fn Abbreviations
  CFArrayRef  weeks
  CFStringRef week
  
  weeks = fn DaysOfWeek
  if ( weeks )
    for week in weeks
      if ( len(week) )
        NSLog(@"%ld\t%@",fn MinAbbreviationLength( week ),week)
      else
        NSLog(@"NULL")
      end if
    next
  end if
end fn

fn Abbreviations

HandleEvents
Output:
2	Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2	Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4	E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2	Ehud Segno Maksegno Erob Hamus Arbe Kedame
5	Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4	Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2	domingu llunes martes miércoles xueves vienres sábadu
2	Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6	Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4	Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2	Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5	Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2	nedelia ponedelnik vtornik sriada chetvartak petak sabota
12	sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4	Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16	Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6	dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2	Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2	nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2	nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2	Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2	s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2	zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2	Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1	pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
NULL
7	Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2	sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2	Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2	sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2	dimanche lundi mardi mercredi jeudi vendredi samedi
4	Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2	Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2	k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2	Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2	Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3	ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6	pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7	Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3	ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3	vasárnap hétfö kedd szerda csütörtök péntek szombat
2	Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2	sundio lundio mardio merkurdio jovdio venerdio saturdio
3	Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2	Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4	Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2	domenica lunedí martedí mercoledí giovedí venerdí sabato
2	Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1	Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7	Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3	sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2	Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3	Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12	xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3	Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3	Jabot Manre Juje Wonje Taije Balaire Jarere
5	geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2	Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2	sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7	lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4	djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2	Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3	Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1	Domingo Lunes martes Miercoles Jueves Viernes Sabado
2	Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2	voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4	Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2	nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5	Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2	Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2	nedel^a pondelok utorok streda s^tvrtok piatok sobota
2	Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2	domingo lunes martes miércoles jueves viernes sábado
2	sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7	Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2	söndag måndag tisdag onsdag torsdag fredag lordag
2	Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6	Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7	wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5	Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
7	Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2	nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8	Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6	dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3	Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7	iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2	zuntik montik dinstik mitvokh donershtik fraytik shabes
7	iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7	Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11	Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2	Sun Moon Mars Mercury Jove Venus Saturn
2	zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2	KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5	Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1	Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7	Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12	xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4	djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2	Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Go

Translation of: Kotlin
package main

import(
    "bufio"
    "fmt"
    "os"
    "strings"
)

func distinctStrings(strs []string) []string {
    len := len(strs)
    set := make(map[string]bool, len)
    distinct := make([]string, 0, len)
    for _, str := range strs {
        if !set[str] {
            distinct = append(distinct, str)
            set[str] = true
        }
    }
    return distinct
}

func takeRunes(s string, n int) string {
    i := 0
    for j := range s {
        if i == n {
            return s[:j]
        }
        i++
    }
    return s
}

func main() {
    file, err := os.Open("days_of_week.txt")
    if err != nil {
        fmt.Println("Unable to open file.")
        return
    }
    defer file.Close()
    reader := bufio.NewReader(file)
    lineCount := 0
    for {
        line, err := reader.ReadString('\n')
        if err != nil { // end of file reached
            return
        }
        line = strings.TrimSpace(line)
        lineCount++
        if line == "" {
            fmt.Println()
            continue
        }
        days := strings.Fields(line)
        daysLen := len(days)
        if (len(days) != 7) {
            fmt.Println("There aren't 7 days in line", lineCount)
            return
        }
        if len(distinctStrings(days)) != 7 { // implies some days have the same name
            fmt.Println(" ∞ ", line)
            continue
        }
        for abbrevLen := 1; ; abbrevLen++ {
            abbrevs := make([]string, daysLen)
            for i := 0; i < daysLen; i++ {
                abbrevs[i] = takeRunes(days[i], abbrevLen)
            }
            if len(distinctStrings(abbrevs)) == 7 {
                fmt.Printf("%2d  %s\n", abbrevLen, line)
                break
            }
        }
    }
}
Output:
Same as Kotlin entry.

Groovy

Translation of: Java
class Abbreviations {
    static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("days_of_week.txt"), "utf-8"))
        List<String> readAllLines = br.readLines()

        for (int i = 0; i < readAllLines.size(); i++) {
            String line = readAllLines.get(i)
            if (line.length() == 0) continue

            String[] days = line.split(" ")
            if (days.length != 7) throw new RuntimeException("There aren't 7 days on line " + (i + 1))

            Map<String, Integer> temp = new HashMap<>()
            for (String day : days) {
                Integer count = temp.getOrDefault(day, 0)
                temp.put(day, count + 1)
            }
            if (temp.size() < 7) {
                System.out.print(" ∞  ")
                System.out.println(line)
                continue
            }

            int len = 1
            while (true) {
                temp.clear()
                for (String day : days) {
                    String sd
                    if (len >= day.length()) {
                        sd = day
                    } else {
                        sd = day.substring(0, len)
                    }
                    Integer count = temp.getOrDefault(sd, 0)
                    temp.put(sd, count + 1)
                }
                if (temp.size() == 7) {
                    System.out.printf("%2d  %s\n", len, line)
                    break
                }
                len++
            }
        }
    }
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djel� E_h�n� E_mart� E_m�rkur� E_enjte E_premte E_shtun�
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes mi�rcoles xueves vienres s�badu
 2  Bazar_g�n� Birinci_g�n �kinci_g�n ���nc�_g�n D�rd�nc�_g�n Bes,inci_g�n Alt�nc�_g�n
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi M�kredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^l� �ter� str^eda c^tvrtek p�tek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Ja�do Vendredo Sabato
 1  p�hap�ev esmasp�ev teisip�ev kolmap�ev neljap�ev reede laup�ev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur m�nadagur t�sdaguy mikudagur h�sdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes M�rcores Joves Venres S�bado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  p�pule p�`akahi p�`alua p�`akolu p�`ah� p�`alima p�`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vas�rnap h�tf� kedd szerda cs�t�rt�k p�ntek szombat
 2  Sunnudagur M�nudagur �ridjudagur Midvikudagar Fimmtudagur F�studagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  D�_Domhnaigh D�_Luain D�_M�irt D�_Ceadaoin D�_ardaoin D�_hAoine D�_Sathairn
 2  domenica luned� marted� mercoled� gioved� venerd� sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lun� Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_r� xing-_qi-_yi-. xing-_qi-_�r xing-_qi-_san-. xing-_qi-_s� xing-_qi-_wuv. xing-_qi-_li�
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo min�mishi m�rtes mi�rkoles misheushi b�rnashi mish�baro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sfndag mandag tirsdag onsdag torsdag fredag lfrdag
 7  lo_dimenge lo_diluns lo_dimar� lo_dim�rcres lo_dij�us lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabi�rna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire ter�a-feire quarta-feire quinta-feire sexta-feira s�bado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminic� Luni Mart'i Miercuri Joi Vineri S�mb�t�
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-m�irt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes mi�rcoles jueves viernes s�bado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  s�ndag m�ndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  L�-p�i-j�t P�i-it P�i-j� P�i-sa� P�i-s� P�i-g�. P�i-l�k
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali �ar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_Nh�.t Th�*_Hai Th�*_Ba Th�*_Tu* Th�*_Na'm Th�*_S�u Th�*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lun� Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_g�n� Bazar_�rt�si ��rs,�nb�_axs,am� ��rs,�nb�_g�n� C�m�_axs,am� C�m�_g�n� C�m�_Senb�
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres S�bado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_ti�n xing-_qi-_yi-. xing-_qi-_�r xing-_qi-_san-. xing-_qi-_s� xing-_qi-_wuv. xing-_qi-_li�
 4  djadomingu djaluna djamars djarason djaweps djabi�rn� djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Haskell

import Data.List (inits, intercalate, transpose)
import qualified Data.Set as S

--------------- MINIMUM ABBREVIATION LENGTH --------------

minAbbrevnLength :: [String] -> Int
minAbbrevlnLength [] = 0
minAbbrevnLength xs =
  length . head . S.toList . head $
    dropWhile ((< n) . S.size) $
      S.fromList
        <$> transpose (inits <$> xs)
  where
    n = length xs

--------------------------- TEST -------------------------
main :: IO ()
main = do
  s <- readFile "./weekDayNames.txt"
  mapM_ putStrLn $
    take 10 $
      intercalate "\t"
        . (<*>)
          [ show . minAbbrevnLength . words,
            id
          ]
        . return
        <$> lines s
Output:
2    Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2    Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4    E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2    Ehud Segno Maksegno Erob Hamus Arbe Kedame
5    Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4    Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2    domingu llunes martes miércoles xueves vienres sábadu
2    Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6    Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4    Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar

J

NB. y is words in boxes
abbreviation_length =: monad define
 N =. # y
 for_i. i. >: >./ #&> y do.
  NB. if the length of the set of length i prefixes matches the length of the row
  if. N -: # ~. i ({. &>) y do.
   i return.
  end.
 end.
)

NB. use: auto_abbreviate DAY_NAMES
auto_abbreviate =: 3 :0
 y =. y -. CR
 lines =. [;._2 y
 a =. <@([: <;._2 ,&' ');._2 y
 L =. abbreviation_length&> a
 ((' ',~":)&> L) ,"1 lines
)
   DAY_NAMES =: noun define
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë

Ehud Segno Maksegno Erob Hamus Arbe Kedame
Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
)

   auto_abbreviate DAY_NAMES
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday                
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag               
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë              
0                                                                         
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame                              
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit

Java

Translation of: D
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Abbreviations {
    public static void main(String[] args) throws IOException {
        Path path = Paths.get("days_of_week.txt");
        List<String> readAllLines = Files.readAllLines(path);
        for (int i = 0; i < readAllLines.size(); i++) {
            String line = readAllLines.get(i);
            if (line.length() == 0) continue;

            String[] days = line.split(" ");
            if (days.length != 7) throw new RuntimeException("There aren't 7 days on line " + (i + 1));

            Map<String, Integer> temp = new HashMap<>();
            for (String day : days) {
                Integer count = temp.getOrDefault(day, 0);
                temp.put(day, count + 1);
            }
            if (temp.size() < 7) {
                System.out.print(" ∞  ");
                System.out.println(line);
                continue;
            }

            int len = 1;
            while (true) {
                temp.clear();
                for (String day : days) {
                    String sd;
                    if (len >= day.length()) {
                        sd = day;
                    } else {
                        sd = day.substring(0, len);
                    }
                    Integer count = temp.getOrDefault(sd, 0);
                    temp.put(sd, count + 1);
                }
                if (temp.size() == 7) {
                    System.out.printf("%2d  %s\n", len, line);
                    break;
                }
                len++;
            }
        }
    }
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miércoles xueves vienres sábadu
 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miércoles jueves viernes sábado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  söndag måndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

JavaScript

Procedural

The list of the names was edited and embedded in the HTML-Document with a <script>-tag, where it is accessible as an array called $list.

Array.prototype.hasDoubles = function() {
  let arr = this.slice();
  while (arr.length > 1) {
    let cur = arr.shift();
    if (arr.includes(cur)) return true;
  }
  return false;
}

function getMinAbbrLen(arr) {
  if (arr.length <= 1) return '';
  let testArr = [],
      len = 0, i;
  do {
    len++;
    for (i = 0; i < arr.length; i++)
      testArr[i] = arr[i].substr(0, len);
  } while (testArr.hasDoubles());
  return len;
}

// testing
for (let x = 0; x < list.length; x++) {
  let days = list[x].split(' '),
      l    = getMinAbbrLen(days);
  for (let y = 0; y < days.length; y++)
    days[y] = days[y].substring(0, l);
  document.write(`<p>(${l}): ${days.join('. ')}.</p>`);
}
Output:
(2): Su. Mo. Tu. We. Th. Fr. Sa.
(2): So. Ma. Di. Wo. Do. Vr. Sa.
(4): E_dj. E_hë. E_ma. E_më. E_en. E_pr. E_sh.
(2): Eh. Se. Ma. Er. Ha. Ar. Ke.
(5): Al_Ah. Al_It. Al_Th. Al_Ar. Al_Ka. Al_Go. Al_Sa.
(4): Guir. Yerg. Yere. Tcho. Hink. Ourp. Shap.
(2): do. ll. ma. mi. xu. vi. sá.
(2): Ba. Bi. Çk. Üç. DÖ. Be. Al.
(6): Igande. Astele. Astear. Asteaz. Ostegu. Ostira. Larunb.
(4): Robi. Shom. Mong. Budh. BRih. Shuk. Shon.
(2): Ne. Po. Ut. Sr. Cx. Pe. Su.
(5): Disul. Dilun. Dimeu. Dimer. Diria. Digwe. Disad.
(2): ne. po. vt. sr. ch. pe. sa.
(12): sing_kei_yah. sing_kei_yat. sing_kei_yee. sing_kei_saa. sing_kei_sie. sing_kei_ng. sing_kei_luk.
(4): Dium. Dill. Dima. Dime. Dijo. Dive. Diss.
(16): Dzeenkk-eh. Dzeehn_kk-ehreh. Dzeehn_kk-ehreh_. Tah_neesee_dzeeh. Deehn_ghee_dzee-. Tl-oowey_tts-el_. Dzeentt-ahzee.
(6): dy_Sul. dy_Lun. dy_Meu. dy_Mer. dy_You. dy_Gwe. dy_Sad.
(2): Di. Le. Ma. Mè. Je. Va. Sa.
(2): ne. po. ut. sr. cx. pe. su.
(2): ne. po. út. st. c^. pá. so.
(2): So. Mo. Ti. Wa. TO. Fe. Sa.
(2): s0. ma. ti. on. to. fr. l0.
(2): zo. ma. di. wo. do. vr. za.
(2): Di. Lu. Ma. Me. ^J. Ve. Sa.
(1): p. e. t. k. n. r. l.
(): .
(7): Diu_pri. Diu_seq. Diu_tri. Diu_qua. Diu_qui. Diu_sex. Diu_sab.
(2): su. má. tÿ. mi. hó. fr. le.
(2): Ye. Do. Se. Ch. Pa. Jo. Sh.
(2): su. ma. ti. ke. to. pe. la.
(2): di. lu. ma. me. je. ve. sa.
(4): Snei. Moan. Tiis. Woan. Tone. Free. Sneo.
(2): Do. Se. Ma. Mé. Jo. Ve. Sá.
(2): k'. or. sa. ot. kh. p'. sh.
(2): So. Mo. Di. Mi. Do. Fr. Sa.
(2): Ki. De. Tr. Te. Pe. Pa. Sa.
(3): rav. som. man. bud. gur. shu. sha.
(6): pópule. pó`aka. pó`alu. pó`ako. pó`ahá. pó`ali. pó`aon.
(7): Yom_ris. Yom_she. Yom_shl. Yom_rev. Yom_cha. Yom_shi. Shabat.
(3): rav. som. man. bud. bra. shu. sha.
(3): vas. hét. ked. sze. csü. pén. szo.
(2): Su. Má. ╞r. Mi. Fi. FÖ. La.
(2): su. lu. ma. me. jo. ve. sa.
(3): Min. Sen. Sel. Rab. Kam. Jum. Sab.
(2): Do. Lu. Ma. Me. Jo. Ve. Sa.
(4): Dé_D. Dé_L. Dé_M. Dé_C. Dé_a. Dé_h. Dé_S.
(2): do. lu. ma. me. gi. ve. sa.
(2): Ni. Ge. Ka. Su. Mo. Ki. Do.
(1): I. W. H. S. M. K. T.
(7): Dies_Do. Dies_Lu. Dies_Ma. Dies_Me. Dies_Io. Dies_Ve. Dies_Sa.
(3): sve. pir. otr. tre. cet. pie. ses.
(2): Se. Pi. An. Tr. Ke. Pe. S^.
(3): Wan. Kaz. Wal. Muk. Kiw. Nna. Wam.
(12): xing-_qi-_rì. xing-_qi-_yi. xing-_qi-_èr. xing-_qi-_sa. xing-_qi-_sì. xing-_qi-_wu. xing-_qi-_li.
(3): Jed. Jel. Jem. Jec. Jar. Jeh. Jes.
(3): Jab. Man. Juj. Won. Tai. Bal. Jar.
(5): gemin. minòm. márte. mièrk. mishe. bèrna. mishá.
(2): Ah. Is. Se. Ra. Kh. Ju. Sa.
(2): sφ. ma. ti. on. to. fr. lφ.
(7): lo_dime. lo_dilu. lo_dima. lo_dimè. lo_dijò. lo_dive. lo_diss.
(4): djad. djal. djam. djar. djaw. djab. djas.
(2): Ni. Po. Wt. S,. Cz. Pi. So.
(3): Dom. seg. ter. qua. qui. sex. såb.
(1): D. L. m. M. J. V. S.
(2): Du. Lu. Ma. Mi. Jo. Vi. Sâ.
(2): vo. po. vt. sr. ch. py. su.
(4): Sund. Di-l. Di-m. Di-c. Di-a. Di-h. Di-s.
(2): ne. po. ut. sr. cx. pe. su.
(5): Sonta. Mmant. Labob. Labor. Labon. Laboh. Moqeb.
(2): Ir. Sa. An. Ba. Br. Si. Se.
(2): ne. po. ut. st. s^. pi. so.
(2): Ne. Po. To. Sr. Cx. Pe. So.
(2): do. lu. ma. mi. ju. vi. sá.
(2): so. mu. tu. dr. fo. fr. Sa.
(7): Jumapil. Jumatat. Jumanne. Jumatan. Alhamis. Ijumaa. Jumamos.
(2): sö. må. ti. on. to. fr. lo.
(2): Li. Lu. Ma. Mi. Hu. Bi. Sa.
(6): Lé-pài. Pài-it. Pài-jï. Pài-sa. Pài-sì. Pài-gÖ. Pài-lá.
(7): wan-ar-. wan-tja. wan-ang. wan-pho. wan-pha. wan-soo. wan-sao.
(5): Tship. Mosup. Labob. Labor. Labon. Labot. Matlh.
(6): Pazar. Pazart. Sali. Çar,sa. Per,se. Cuma. Cumart.
(2): ne. po. vi. se. ch. py. su.
(8): Chu?_Nhâ. Thú*_Hai. Thú*_Ba. Thú*_Tu*. Thú*_Na'. Thú*_Sáu. Thú*_Ba?.
(6): dydd_S. dyds_L. dydd_M. dyds_M. dydd_I. dydd_G. dyds_S.
(3): Dib. Alt. Tal. All. Al_. Alj. Gaa.
(7): iCawa. uMvulo. uLwesib. uLwesit. uLuwesi. uLwesih. uMgqibe.
(2): zu. mo. di. mi. do. fr. sh.
(7): iSonto. uMsombu. uLwesib. uLwesit. uLwesin. uLwesih. uMgqibe.
(7): Dies_Do. Dies_Lu. Dies_Ma. Dies_Me. Dies_Io. Dies_Ve. Dies_Sa.
(11): Bazar_gÜnÜ. Bazar_ærtæs. Çærs,ænbæ_a. Çærs,ænbæ_g. CÜmæ_axs,am. CÜmæ_gÜnÜ. CÜmæ_Senbæ.
(2): Su. Mo. Ma. Me. Jo. Ve. Sa.
(2): zo. ma. di. wo. do. vr. za.
(2): Ko. Gy. Be. Ku. YO. Fe. Me.
(5): Sonnt. Monta. Diens. Mittw. Donne. Freit. Sonna.
(1): D. L. T. C. X. V. S.
(7): Dies_So. Dies_Lu. Dies_Ma. Dies_Me. Dies_Io. Dies_Ve. Dies_Sa.
(12): xing-_qi-_ti. xing-_qi-_yi. xing-_qi-_èr. xing-_qi-_sa. xing-_qi-_sì. xing-_qi-_wu. xing-_qi-_li.
(4): djad. djal. djam. djar. djaw. djab. djas.
(2): Ki. At. Qu. Il. Ch. Ku. In.

Functional

JavaScript, as a language for embedded interpreter environments, defines no intrinsic IO libraries.

Where the procedural example above assumes an interpreter embedded in a browser, with access to a DOM model, this example assumes, for contrast, an interpreter embedded in the form of a macOS JSContext, with no DOM model present, but with access to the 'JS for Automation' library. It reads a text file in from the local file-system:

Works with: MacOS JXA
(() => {
    "use strict";

    // ----- MINIMUM LENGTH OF UNIQUE ABBREVIATIONS ------

    // minAbbrevnLength :: [String] -> Int
    const minAbbrevnLength = xs => {
        const n = xs.length;

        return 0 < n ? (() => {
            const
                abbrs = dropWhile(ks => n > ks.length)(
                    transpose(xs.map(inits))
                    .map(prefixes => Array.from(
                        new Set(
                            prefixes.map(ws => ws.join(""))
                        )
                    ))
                );

            return (abbrs.length && abbrs[0][0].length) || (
                maximum(xs.map(x => x.length))
            );
        })() : 0;
    };

    // ---------------------- TEST -----------------------
    // main :: IO ()
    const main = () =>
        readFile(
            "~/Desktop/weekDayNames.txt"
        )
        .split("\n")
        // Display of just the first few lines.
        .slice(0, 10)
        .map(s => {
            const
                ws = words(s),
                n = minAbbrevnLength(ws);

            return `${n}: ${ws.map(w => w.slice(0, n))}`;
        })
        .join("\n");


    // ----------- MACOS JS FOR AUTOMATION IO ------------

    // readFile :: FilePath -> IO String
    const readFile = fp => {
        // The contents of a text file at the
        // filepath fp.
        const
            e = $(),
            ns = $.NSString
            .stringWithContentsOfFileEncodingError(
                $(fp).stringByStandardizingPath,
                $.NSUTF8StringEncoding,
                e
            );

        return ObjC.unwrap(
            ns.isNil() ? (
                e.localizedDescription
            ) : ns
        );
    };

    // --------------------- GENERIC ---------------------

    // dropWhile :: (a -> Bool) -> [a] -> [a]
    // dropWhile :: (Char -> Bool) -> String -> String
    const dropWhile = p =>
        // The suffix remainining after takeWhile p xs.
        xs => {
            const n = xs.length;

            return xs.slice(
                0 < n ? until(
                    i => n === i || !p(xs[i])
                )(i => 1 + i)(0) : 0
            );
        };


    // inits :: [a] -> [[a]]
    // inits :: String -> [String]
    const inits = xs =>
        // All prefixes of the argument,
        // shortest first.
        [...xs].map(
            (_, i, ys) => ys.slice(0, 1 + i)
        );


    // maximum :: Ord a => [a] -> a
    const maximum = xs => (
        // The largest value in a non-empty list.
        ys => 0 < ys.length ? (
            ys.slice(1).reduce(
                (a, y) => y > a ? (
                    y
                ) : a, ys[0]
            )
        ) : undefined
    )(xs);


    // transpose :: [[a]] -> [[a]]
    const transpose = rows => {
        // If any rows are shorter than those that follow,
        // their elements are skipped:
        // > transpose [[10,11],[20],[],[30,31,32]]
        //             == [[10,20,30],[11,31],[32]]
        const go = xss =>
            0 < xss.length ? (() => {
                const
                    h = xss[0],
                    t = xss.slice(1);

                return 0 < h.length ? [
                    [h[0]].concat(t.reduce(
                        (a, xs) => a.concat(
                            0 < xs.length ? (
                                [xs[0]]
                            ) : []
                        ),
                        []
                    ))
                ].concat(go([h.slice(1)].concat(
                    t.map(xs => xs.slice(1))
                ))) : go(t);
            })() : [];

        return go(rows);
    };


    // until :: (a -> Bool) -> (a -> a) -> a -> a
    const until = p =>
        // The value resulting from repeated applications
        // of f to the seed value x, terminating when
        // that result returns true for the predicate p.
        f => x => {
            let v = x;

            while (!p(v)) {
                v = f(v);
            }

            return v;
        };


    // words :: String -> [String]
    const words = s =>
        // List of space-delimited sub-strings.
        s.split(/\s+/u);

    // MAIN ---
    return main();
})();
Output:
2: Su,Mo,Tu,We,Th,Fr,Sa
2: So,Ma,Di,Wo,Do,Vr,Sa
4: E_dj,E_hë,E_ma,E_më,E_en,E_pr,E_sh
2: Eh,Se,Ma,Er,Ha,Ar,Ke
5: Al_Ah,Al_It,Al_Th,Al_Ar,Al_Ka,Al_Go,Al_Sa
4: Guir,Yerg,Yere,Tcho,Hink,Ourp,Shap
2: do,ll,ma,mi,xu,vi,sá
2: Ba,Bi,Çk,Üç,DÖ,Be,Al
6: Igande,Astele,Astear,Asteaz,Ostegu,Ostira,Larunb
4: Robi,Shom,Mong,Budh,BRih,Shuk,Shon

jq

Works with: jq

Also works with gojq, the Go implementation of jq, and with fq.

Adapted from Wren

def trim: sub("^  *";"") | sub("  $";"");

# Each item in the stream should be a string with $n names
def minimum_abbreviation_lengths(stream; $n):
  foreach (stream|trim) as $line ({i: 0};
    .i+=1
    | if $line == "" then .emit = ""
      else [$line|splits("  *")] as $days
      | if ($days|length != $n) then .emit = "WARNING: line \(.i) does not have \($n) tokens"
        elif ($days|unique|length < $n)  # some days have the same name
        then .emit = "∞: \($line)"
        else .len = 1
	| .emit = false
        | until(.emit;
	    .len as $len
            | if ($days|map(.[:$len])|unique|length == $n) 
              then .emit = "\($len): \($line)"
              else .len += 1
	      end)
	end
      end;
      .emit) ;

minimum_abbreviation_lengths(inputs; 7)

Invocation: jq -nrR -f abbreviations-automatic.jq days_of_week.txt

Output:

Semantically identical to that at Wren.

Julia

const text = """
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
Ehud Segno Maksegno Erob Hamus Arbe Kedame
Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
domingu llunes martes miércoles xueves vienres sábadu
Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
nedelia ponedelnik vtornik sriada chetvartak petak sabota
sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
dimanche lundi mardi mercredi jeudi vendredi samedi
Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
Domingo Segunda_feira Martes Mércores Joves Venres Sábado
k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
vasárnap hétfö kedd szerda csütörtök péntek szombat
Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
sundio lundio mardio merkurdio jovdio venerdio saturdio
Minggu Senin Selasa Rabu Kamis Jumat Sabtu
Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
domenica lunedí martedí mercoledí giovedí venerdí sabato
Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
Jabot Manre Juje Wonje Taije Balaire Jarere
geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
sφndag mandag tirsdag onsdag torsdag fredag lφrdag
lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
djadomingo djaluna djamars djarason djaweps djabièrna djasabra
Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
Domingo Lunes martes Miercoles Jueves Viernes Sabado
Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
nedel^a pondelok utorok streda s^tvrtok piatok sobota
Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
domingo lunes martes miércoles jueves viernes sábado
sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
söndag måndag tisdag onsdag torsdag fredag lordag
Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
zuntik montik dinstik mitvokh donershtik fraytik shabes
iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
Sun Moon Mars Mercury Jove Venus Saturn
zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau"""

function processweek(txt)
    for lin in split(txt, "\n")
        print(lin)
        if length(lin) < 7
            println("A blank line returns \"\", a blank string.")
            continue
        end
        words = map(x->"$x", split(lin, r"\s+"))
        minlen = minimum(map(length, words))
        abbrev = fill("", length(words))
        for i in 1:minlen
            if length(unique(wrd -> split(wrd, "")[1:i], words)) == length(words)
                for (k, word) in enumerate(words)
                    abbrev[k] = join(split(word, "")[1:i], "")
                end
                println(" => ", abbrev, ", which are length ", i)
                break
            elseif i == minlen 
                println(" => Could not find abbreviations for the week")
            end
        end
    end
end

processweek(text)
Output:

(Showing first 10 lines.) Sunday Monday Tuesday Wednesday Thursday Friday Saturday => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], which are length 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag => ["So", "Ma", "Di", "Wo", "Do", "Vr", "Sa"], which are length 2 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë => ["E_dj", "E_hë", "E_ma", "E_më", "E_en", "E_pr", "E_sh"], which are length 4 Ehud Segno Maksegno Erob Hamus Arbe Kedame => ["Eh", "Se", "Ma", "Er", "Ha", "Ar", "Ke"], which are length 2 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit => ["Al_Ah", "Al_It", "Al_Th", "Al_Ar", "Al_Ka", "Al_Go", "Al_Sa"], which are length 5 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat => ["Guir", "Yerg", "Yere", "Tcho", "Hink", "Ourp", "Shap"], which are length 4 domingu llunes martes miércoles xueves vienres sábadu => ["do", "ll", "ma", "mi", "xu", "vi", "sá"], which are length 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn => ["Ba", "Bi", "Çk", "Üç", "DÖ", "Be", "Al"], which are length 2 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat => ["Igande", "Astele", "Astear", "Asteaz", "Ostegu", "Ostira", "Larunb"], which are length 6 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar => ["Robi", "Shom", "Mong", "Budh", "BRih", "Shuk", "Shon"], which are length 4

Kotlin

Original O(n2) solution

where n is the number of strings in each line.

// version 1.1.4-3

import java.io.File

val r = Regex("[ ]+")

fun main(args: Array<String>) {
    val lines = File("days_of_week.txt").readLines()
    for ((i, line) in lines.withIndex()) {
        if (line.trim().isEmpty()) {
            println()
            continue
        }
        val days = line.trim().split(r)
        if (days.size != 7) throw RuntimeException("There aren't 7 days in line ${i + 1}")
        if (days.distinct().size < 7) { // implies some days have the same name
            println(" ∞  $line")
            continue
        }
        var len = 1
        while (true) {
            if (days.map { it.take(len) }.distinct().size ==  7) {
                println("${"%2d".format(len)}  $line")
                break
            }
            len++
        }
    }  
}
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miércoles xueves vienres sábadu
 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
    
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miércoles jueves viernes sábado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  söndag måndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Alternative O(n log n) solution based on sorting

import java.io.File
import kotlin.math.max

fun getMinimumPrefixLength(distinctWords: Iterable<String>): Int {
    return distinctWords
        .sorted()
        .fold(Pair("", 0),
            { (previousWord, minLength), currentWord ->
                val firstNonMatchingIdx = previousWord
                    .asSequence()
                    .zip(currentWord.asSequence())
                    .indexOfFirst { it.first != it.second }
                return@fold Pair(
                    currentWord,
                    max(
                        // firstNonMatchingIdx would be -1 iff  previousWord is a prefix of currentWord
                        if (firstNonMatchingIdx != -1) firstNonMatchingIdx + 1 else previousWord.length + 1,
                        minLength)
                )
            })
        .second
}

fun getMinimumPrefixLength(whitespaceSeparatedDistinctWords: String) =
    getMinimumPrefixLength(whitespaceSeparatedDistinctWords.split(Regex("\\s+")))

fun main() {
    File("/tmp/input.txt").useLines {
        it.map(String::trim)
            .filter(String::isNotEmpty)
            .map({ "${getMinimumPrefixLength(it).toString().padEnd(5)} ${it}" })
            .forEach(::println)
    }
}
Output:
2     Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2     Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4     E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2     Ehud Segno Maksegno Erob Hamus Arbe Kedame
5     Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4     Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2     domingu llunes martes miércoles xueves vienres sábadu
2     Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6     Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4     Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2     Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5     Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2     nedelia ponedelnik vtornik sriada chetvartak petak sabota
12    sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4     Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16    Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6     dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2     Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2     nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2     nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2     Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2     s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2     zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2     Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1     pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
7     Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2     sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2     Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2     sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2     dimanche lundi mardi mercredi jeudi vendredi samedi
4     Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2     Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2     k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2     Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2     Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3     ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6     pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7     Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3     ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3     vasárnap hétfö kedd szerda csütörtök péntek szombat
2     Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2     sundio lundio mardio merkurdio jovdio venerdio saturdio
3     Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2     Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4     Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2     domenica lunedí martedí mercoledí giovedí venerdí sabato
2     Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1     Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7     Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3     sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2     Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3     Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12    xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3     Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3     Jabot Manre Juje Wonje Taije Balaire Jarere
5     geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2     Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2     sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7     lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4     djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2     Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3     Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1     Domingo Lunes martes Miercoles Jueves Viernes Sabado
2     Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2     voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4     Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2     nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5     Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2     Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2     nedel^a pondelok utorok streda s^tvrtok piatok sobota
2     Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2     domingo lunes martes miércoles jueves viernes sábado
2     sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7     Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2     söndag måndag tisdag onsdag torsdag fredag lordag
2     Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6     Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7     wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5     Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6     Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2     nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8     Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6     dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3     Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7     iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2     zuntik montik dinstik mitvokh donershtik fraytik shabes
7     iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7     Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11    Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2     Sun Moon Mars Mercury Jove Venus Saturn
2     zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2     KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5     Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1     Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7     Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12    xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4     djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2     Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Ksh

#!/bin/ksh

# Abbreviations, automatic

#	# Variables:
#
dow_file='../dow'

typeset -T Dow_T=(
	typeset -a -h	"Week day name array"			dow
	typeset -si -h	"minimum length abbreviation"	minabv

	function init_dow {
		_.minabv=$1
		_.dow=( $2 )
	}

	function print_wk {
		typeset i ; typeset -si i

		printf "(%d)  " ${_.minabv}
		for((i=0; i<${#_.dow[*]}; i++)); do
			printf "%${_.minabv}s " ${_.dow[i]:0:${_.minabv}}
		done
		printf "\n"
	}
)

#	# Functions:
#
#	# Function _file2arr(fn, arr) - read file fn into arr
#
function _file2arr {
	typeset _fn ; _fn="$1"
	typeset _arr ; nameref _arr="$2"
	typeset _i ; typeset -si _i=0

	while read; do
		_arr[_i++]="$REPLY"
	done < ${_fn}

}

#	# Function _minabbr(buff) - return the min length abbr for items in buff
#
function _minabbr {
	typeset _buf ; _buf="$1"
	typeset _i _flg ; typeset -si _i=0 _cnt
	typeset _item _list _abr

	until (( _cnt == 7 )); do
		unset _list
		_cnt=0
		(( _i++ ))
		for _item in ${_buf}; do
			_abr=${_item:0:${_i}}
			[[ ${_abr} == @(${_list}) ]] && break
			_list+="${_abr}|"
			(( _cnt++ ))
		done
	done

	echo ${_i}
}

 ######
# main #
 ######

typeset -a dow langs
_file2arr "${dow_file}" dow

for ((i=0; i<${#dow[*]}; i++)); do
	(( ! ${#dow[i]} )) && { print "Blank Input, line $((i+1))" ; continue ;}
	alen=$(_minabbr "${dow[i]}")
	Dow_T langs[i]
	langs[i].init_dow ${alen} "${dow[i]}"
	
	(( $((RANDOM%100+1))<=5 )) && { printf "%d. " $((i+1)) ; langs[i].print_wk ;}
done
Output:

15. (4) Dium Dill Dima Dime Dijo Dive Diss Blank Input, line 26 46. (4) Dé_D Dé_L Dé_M Dé_C Dé_a Dé_h Dé_S 73. (2) do lu ma mi ju vi sá 83. (8) Chu?_Nhâ Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na' Thú*_Sáu Thú*_Ba? Blank Input, line 100

Lua

function split(line)
    local wa = {}
    for i in string.gmatch(line, "%S+") do
        table.insert(wa, i)
    end
    return wa
end

-- main
local file = assert(io.open("days_of_week.txt", "r"))
io.input(file)

local line_num = 0
while true do
    local line = io.read()
    if line == nil then break end
    line_num = line_num + 1

    if string.len(line) > 0 then
        local days = split(line)
        if #days ~= 7 then
            error("There aren't 7 days in line "..line_num)
        end

        local temp = {}
        for i,day in pairs(days) do
            if temp[day] ~= nil then
                io.stderr:write(" ∞  "..line.."\n")
            else
                temp[day] = true
            end
        end

        local length = 1
        while length < 50 do
            temp = {}
            local count = 0
            for i,day in pairs(days) do
                local key = string.sub(day, 0, length)
                if temp[key] ~= nil then break end
                temp[key] = true
                count = count + 1
            end
            if count == 7 then
                print(string.format("%2d  %s", length, line))
                break
            end
            length = length + 1
        end
    end
end
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miércoles xueves vienres sábadu
 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 7  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 5  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miércoles jueves viernes sábado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  söndag måndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 7  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 9  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
15  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Mathematica /Wolfram Language

(*This function gives all 'heads' of str of length 1 to maxLength. Since the input data was formatted to use underscores in place of spaces, there is an edge case where distinct abbreviations derived from the input data would actually not be distinct in the 'real' abbreviations. See further comments below regarding the difference between my output and the output of other solutions.*)
Abbreviations[maxLength_Integer][str_String]:=Array[StringTake[StringPadRight[str,maxLength,"_"],#]&,maxLength];

(*Given a list of words (weekday names), this function expands each to its abbreviations and then picks the first 'column' that contains no duplicates. The failure case isn't really needed for this specific data, but I included it for completeness.*)
ShortestUniqueAbbreviations[list:{__String}]:=
 With[
  {maxLength=Max[StringLength/@list]},
  SelectFirst[Transpose[Abbreviations[maxLength]/@list],DuplicateFreeQ,"no unique abbreviations possible"]
 ];

(*This function gives the minimum number of characters to distinguish the words (weekday names). It assumes data is a space separated list of weekday names (i.e. one line of the input data). I would prefer to ignore blank lines, but the spec says to return an empty string. Since all of the abbreviations should be the same length because of the padding done by Abbreviations, I could have just selected the first item rather than taking the Max of the StringLength. However, the implmenetation of Abbreviations was very specific to the format of the input data, and so using Max seemed a bit safer and more general.*)
RequiredAbbreviationLength[""]="";
RequiredAbbreviationLength[input_String]:=Max[StringLength/@ShortestUniqueAbbreviations[StringSplit[input]]];
Output:

Comment: My 16th line differs from most other solutions. Whereas the others indicate a need for 16 characters to create unique abbreviations, my solution indicates a need for 17. If you take the first 16 characters of that language's weekday names (with the underscores), you get this:

Dzeenkk-eh
Dzeehn_kk-ehreh
Dzeehn_kk-ehreh_
Tah_neesee_dzeeh
Deehn_ghee_dzee-
Tl-oowey_tts-el_
Dzeentt-ahzee

Notice that if we were to strip the underscores so that we could present the weekdays in their "true" form, the second and third names would become indistinguishable. It's not until you add the 17th character of each weekday name that the "true" abbreviations would be distinguishable. This was the only discrepancy between my solution and others. Full data follows.

2	Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2	Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4	E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2	Ehud Segno Maksegno Erob Hamus Arbe Kedame
5	Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4	Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2	domingu llunes martes miércoles xueves vienres sábadu
2	Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6	Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4	Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2	Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5	Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2	nedelia ponedelnik vtornik sriada chetvartak petak sabota
12	sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4	Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
17	Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6	dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2	Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2	nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2	nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2	Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2	s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2	zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2	Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1	pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
	
7	Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2	sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2	Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2	sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2	dimanche lundi mardi mercredi jeudi vendredi samedi
4	Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2	Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2	k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2	Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2	Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3	ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6	pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7	Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3	ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3	vasárnap hétfö kedd szerda csütörtök péntek szombat
2	Sunnudagur Mánudagur ╞ri\[Delta]judagur Mi\[Delta]vikudagar Fimmtudagur FÖstudagur Laugardagur
2	sundio lundio mardio merkurdio jovdio venerdio saturdio
3	Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2	Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4	Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2	domenica lunedí martedí mercoledí giovedí venerdí sabato
2	Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1	Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7	Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3	sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2	Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3	Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12	xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3	Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3	Jabot Manre Juje Wonje Taije Balaire Jarere
5	geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2	Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2	s\[CurlyPhi]ndag mandag tirsdag onsdag torsdag fredag l\[CurlyPhi]rdag
7	lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4	djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2	Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3	Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1	Domingo Lunes martes Miercoles Jueves Viernes Sabado
2	Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2	voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4	Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2	nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5	Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2	Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2	nedel^a pondelok utorok streda s^tvrtok piatok sobota
2	Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2	domingo lunes martes miércoles jueves viernes sábado
2	sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7	Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2	söndag måndag tisdag onsdag torsdag fredag lordag
2	Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6	Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7	wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5	Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6	Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2	nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8	Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6	dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3	Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7	iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2	zuntik montik dinstik mitvokh donershtik fraytik shabes
7	iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7	Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11	Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2	Sun Moon Mars Mercury Jove Venus Saturn
2	zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2	KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5	Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1	Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7	Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12	xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4	djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2	Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Nim

We have chosen to ignore the case as we considerer that in line Domingo Lunes martes Miercoles Jueves Viernes Sabado, the lower case 'm' for “martes” is a mistake and should not be considered to be relevant. This is different from the choice made by most other solutions

We provide two solutions, one consisting to build the abbreviations for each language and stopping when all of them are different, the second sorting the list of day names for each language and adjusting the abbreviation length to make sure that two consecutive day names are different. The second method should be more efficient, but it doesn’t really matters here.

Using a set

import sets
import unicode

type Runes = seq[Rune]

var linenum = 0
for line in lines("days.txt"):
  inc linenum
  if line.len > 0:

    # Extract the day names and store them in a sorted list of sequences of runes.
    var days: seq[Runes]
    for day in line.splitWhitespace():
      days.add(day.toLower.toRunes)
    if days.len != 7:
      echo "Wrong number of days at line ", linenum

    # Build the abbreviations and store them in a set.
    var index = 0
    while true:
      var abbrevs: HashSet[seq[Rune]]
      for day in days:
        abbrevs.incl(day[0..min(index, day.high)])
      if abbrevs.card == 7:
        # All abbreviations are different: fine!
        break
      inc index
    echo index + 1, " ", line

  else:
    echo line

Using a sorted list

import algorithm
import unicode

type Runes = seq[Rune]

var linenum = 0
for line in lines("days.txt"):
  inc linenum
  if line.len > 0:

    # Extract the day names and store them in a sorted list of sequences of runes.
    var days: seq[Runes]
    for day in sorted(line.toLower.splitWhitespace()):
      days.add(day.toRunes)
    if days.len != 7:
      echo "Wrong number of days at line ", linenum

    # Compare the first letters of successive day names, incrementing the upper index if necessary.
    var index = 0             # Equal to abbreviation length - 1.
    var prevday = days[0]
    for idx in 1..days.high:
      let currday = days[idx]
      if currday == prevday:
        echo "Double encountered at line ", linenum
      while currday[0..min(index, currday.high)] == prevday[0..min(index, prevday.high)]:
        inc index
      prevday = currday
    echo index + 1, " ", line

  else:
    echo line
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
2 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Objeck

Translation of: Java
use System.IO.File;
use Collection;

class Abbreviations  {
  function : Main(args : String[]) ~ Nil {
    if(args->Size() = 1) {
      Go(args[0]);
    };
  }

  function : Go(file : String) ~ Nil {
    reader := FileReader->New(file);
    leaving {
      reader->Close();
    };
    
    cache := StringMap->New();
    line := reader->ReadString();
    while(line <> Nil) {
      if(line->Size() > 0) {
        days := line->Split(" ");

        cache->Empty();
        each(i : days) {
          day := days[i];
          cache->Insert(day, IntHolder->New(1));
        };

        if(cache->Size() < 7) {
          " ∞ {$line}"->PrintLine();
        };

        len := 1;
        while(true) {
          cache->Empty();
          each(i : days) {
            day := days[i];
            sd : String;
            if(len >= day->Size()) {
              sd := day;
            } 
            else {
              sd := day->SubString(len);
            };

            count := cache->Find(sd)->As(IntHolder);
            if(count = Nil) {
              cache->Insert(sd, IntHolder->New(1));
            }
            else {
              count->Inc();
            };
          };

          if(cache->Size() = 7) {
            "{$len} {$line}"->PrintLine();
            break;
          };
          len += 1;
        };
      };

      line := reader->ReadString();
    };
  }
}
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Perl

Output is the same as for Raku.

Translation of: Raku
use strict;
use utf8;
binmode STDOUT, ":utf8";

sub auto_abbreviate {
    my($string) = @_;
    my @words = split ' ', $string;
    my $max = 0;
    return '' unless @words;
    map { $max = length($_) if length($_) > $max } @words;
    for $i (1..$max) {
        my %seen;
        return $i if @words == grep {!$seen{substr($_,0,$i)}++} @words;
    }
    return '∞';
}

open $fh, '<:encoding(UTF-8)', 'DoWAKA.txt';
while ($_ = <$fh>) {
    print "$.) " . auto_abbreviate($_) . '  ' . $_;
}

Phix

The file abbrev_auto.txt was manually created from the task description. The following code assumes a more recent version of get_text() that strips any leading utf8 bom by default (0.8.0+).

constant lines = get_text("abbrev_auto.txt",GT_LF_STRIPPED)
 
for i=1 to length(lines) do
    string li = lines[i]
    if length(li) then
        sequence days = split(li,no_empty:=true)
        if length(days)!=7 then ?9/0 end if
        integer len = 1
        for j=1 to 7 do
            for k=j+1 to 7 do
                for m=1 to min(length(days[j]),length(days[k])) do
                    if days[j][m]!=days[k][m] then exit end if
                    len = max(len,m+1)
                end for
            end for
        end for
        printf(1,"%d: %s\n",{len,li})
    end if
end for
Output:
2: Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2: Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4: E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2: Ehud Segno Maksegno Erob Hamus Arbe Kedame
5: Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
...

PHP

function genMinAbbr(array $days): array {
    $len = 0;
    while(true) {
    	$dict = [];
    	$len++;
        foreach($days as $day) {
        	$abbr = substr($day, 0, $len);
        	if (isset($dict[$abbr])) continue 2;
        	$dict[$abbr] = true;
        }
        return array_keys($dict);
    }
}

foreach(explode("\n", file_get_contents("days-of-the-week.txt")) as $line) {
    if (!$line) { echo "\n"; continue; }
    echo implode(" ", genMinAbbr(explode(" ", $line))) . "\n";
}
Output:
Su Mo Tu We Th Fr Sa
So Ma Di Wo Do Vr Sa
E_dj E_hë E_ma E_më E_en E_pr E_sh
Eh Se Ma Er Ha Ar Ke
Al_Ah Al_It Al_Th Al_Ar Al_Ka Al_Go Al_Sa
...

Picat

Works with: Picat
import util.

max_length(Words) = Max =>
    Lengths = [len(W): W in Words],
    Max = max(Lengths).

min_abbr([]) = 0.

min_abbr(Line) = Min =>
    Words = split(Line),
    Max = max_length(Words),
    I = 0,
    Abbrevs = [],
    Uniqs = [],
    do
        I := I + 1,
        Abbrevs := [slice(W, 1, I): W in Words],
        Uniqs := sort_remove_dups(Abbrevs)
    while (I < Max, len(Abbrevs) > len(Uniqs)),
    Min = I.

main(Args) =>
    File = Args[1],
    Reader = open(File),
    while (not at_end_of_stream(Reader))
        Line := read_line(Reader),
        Min := min_abbr(Line),
        if (Min > 0) then
            printf("%d %s\n", Min, Line)
        else
            nl
        end
    end.
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Prolog

Works with: SWI Prolog
minimum_abbreviation_length(Day_names, Min_length):-
	sort(Day_names, Sorted_names),
	minimum_abbreviation_length(Sorted_names, Min_length, 1).

minimum_abbreviation_length([_], Min_length, Min_length):- !.
minimum_abbreviation_length([Name1, Name2|Rest], Min_length, M1):-
	common_prefix_length(Name1, Name2, Length),
	M2 is max(M1, Length + 1),
	minimum_abbreviation_length([Name2|Rest], Min_length, M2).

common_prefix_length(String1, String2, Length):-
	string_chars(String1, Chars1),
	string_chars(String2, Chars2),
	common_prefix_length1(Chars1, Chars2, Length, 0).

common_prefix_length1([], _, Length, Length):-!.
common_prefix_length1(_, [], Length, Length):-!.
common_prefix_length1([C1|_], [C2|_], Length, Length):-
	C1 \= C2,
	!.
common_prefix_length1([C|Chars1], [C|Chars2], Length, L1):-
	L2 is L1 + 1,
	common_prefix_length1(Chars1, Chars2, Length, L2).

to_upper_case([], []):-!.
to_upper_case([String|S], [Upper_case|U]):-
    string_upper(String, Upper_case),
    to_upper_case(S, U).

process_line(""):-
    nl,
    !.
process_line(Line):-
    split_string(Line, "\s\t", "\s\t", Day_names),
    to_upper_case(Day_names, Upper),
    minimum_abbreviation_length(Upper, Length),
    writef('%w %w\n', [Length, Line]).

process_stream(Stream):-
    read_line_to_string(Stream, String),
    String \= end_of_file,
    !,
    process_line(String),
    process_stream(Stream).
process_stream(_).

process_file(File):-
    open(File, read, Stream),
    process_stream(Stream),
    close(Stream).

main:-
    process_file("days_of_week.txt").
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
2 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

PureBasic

EnableExplicit
#TZ="|"
#FZ="@"
#WORD_SEPARATOR=Chr(32)
Declare.i abbreviations(txt.s)
Define dataset.s, line_number.i, line_cache.s, result.i, word_index.i, word.s

If OpenConsole("abbreviations-automatic") And ReadFile(0,"./Data/days_of_the_week.txt")
  dataset=ReadString(0,#PB_UTF8|#PB_File_IgnoreEOL) : CloseFile(0)
  line_number=1
  Repeat
    line_cache=StringField(dataset,line_number,#LF$)
    If Len(line_cache)=0 
      PrintN("")
    Else      
      result=abbreviations(line_cache) : PrintN(RSet(Str(result),3)+": "+line_cache)
      word_index=1
      word=StringField(line_cache,word_index,#WORD_SEPARATOR)
      If word : Print(Space(5)) : EndIf
      While word
        Print(LSet(Left(word,result),Len(word)+1))
        word_index+1 : word=StringField(line_cache,word_index,#WORD_SEPARATOR)
      Wend
      PrintN("")     
    EndIf 
    line_number+1
  Until line_number>CountString(dataset,#LF$)
  Input()
EndIf

Procedure.b CompareLetters(sfield.s,letters.i,separator.s=#WORD_SEPARATOR)
  Define word_index.i, buf.s  
  For word_index=1 To CountString(sfield,separator)+1
    buf+LSet(Left(StringField(sfield,word_index,separator),letters),letters,#FZ)+#TZ
  Next
  For word_index=1 To CountString(buf,#TZ)
    If CountString(buf,StringField(buf,word_index,#TZ))>1 : ProcedureReturn #True : EndIf
  Next
  ProcedureReturn #False
EndProcedure

Procedure.i abbreviations(txt.s)
  Define letters.i=1          
  While CompareLetters(txt,letters) : letters+1 : Wend  
  ProcedureReturn letters
EndProcedure
Output:
  2: Sunday Monday Tuesday Wednesday Thursday Friday Saturday
     Su     Mo     Tu      We        Th       Fr     Sa       
  2: Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
     So     Ma      Di      Wo       Do        Vr     Sa       
  4: E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
     E_dj    E_hë   E_ma    E_më      E_en    E_pr     E_sh     
  2: Ehud Segno Maksegno Erob Hamus Arbe Kedame
     Eh   Se    Ma       Er   Ha    Ar   Ke     
  5: Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
     Al_Ah   Al_It      Al_Th         Al_Ar      Al_Ka    Al_Go      Al_Sa    
  4: Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
     Guir     Yerg          Yere         Tcho           Hink        Ourp   Shap   
  2: domingu llunes martes miércoles xueves vienres sábadu
     do      ll     ma     mi        xu     vi      sá     
  2: Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
     Ba         Bi          Çk         Üç         DÖ           Be           Al          
  6: Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
     Igande Astele    Astear   Asteaz    Ostegu  Ostira  Larunb   
  4: Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
     Robi     Shom     Mong       Budh      BRih            Shuk       Shon      
  2: Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
     Ne       Po         Ut     Sr      Cx        Pe    Su     
  5: Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
     Disul Dilun Dimeu    Dimer      Diria   Digwe    Disad    
  2: nedelia ponedelnik vtornik sriada chetvartak petak sabota
     ne      po         vt      sr     ch         pe    sa     
 12: sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
     sing_kei_yah  sing_kei_yat sing_kei_yee sing_kei_saa  sing_kei_sie sing_kei_ng sing_kei_luk 
  4: Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
     Dium     Dill    Dima    Dime     Dijo   Dive      Diss     
 16: Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts el_dehlee Dzeentt-ahzee
     Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_                Tah_neesee_dzeeh      Deehn_ghee_dzee-    Tl-oowey_tts-el_       Dzeentt-ahzee 
  6: dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
     dy_Sul dy_Lun dy_Meu    dy_Mer     dy_You dy_Gwe    dy_Sad    
  2: Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
     Di      Le    Ma   Mè      Je   Va       Sa    
  2: nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
     ne       po          ut     sr      cx        pe    su     
  2: nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
     ne      po       út    st      c^       pá    so     
  2: Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
     So     Mo     Ti       Wa         TO       Fe       Sa      
  2: s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
     s0     ma     ti      on     to      fr     l0     
  2: zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
     zo     ma      di      wo       do        vr      za       
  2: Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
     Di       Lu    Ma    Me       ^J     Ve       Sa     
  1: pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
     p        e         t         k         n         r     l       

  7: Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
     Diu_pri   Diu_seq     Diu_tri     Diu_qua      Diu_qui      Diu_sex     Diu_sab     
  2: sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
     su         má        tÿ       mi        hó       fr           le          
  2: Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
     Ye           Do          Se           Ch               Pa            Jo     Sh       
  2: sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
     su        ma        ti      ke         to       pe        la       
  2: dimanche lundi mardi mercredi jeudi vendredi samedi
     di       lu    ma    me       je    ve       sa     
  4: Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
     Snei  Moan    Tiis    Woan     Tone      Free  Sneo  
  2: Domingo Segunda_feira Martes Mércores Joves Venres Sábado
     Do      Se            Ma     Mé       Jo    Ve     Sá     
  2: k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
     k'     or        sa         ot          kh          p'          sh      
  2: Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
     So      Mo     Di       Mi       Do         Fr      Sa      
  2: Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
     Ki       De       Tr     Te       Pe      Pa         Sa      
  3: ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
     rav      som     man        bud      gur      shu        sha       
  6: pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
     pópule pó`aka   pó`alu  pó`ako   pó`ahá pó`ali   pó`aon  
  7: Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
     Yom_ris    Yom_she   Yom_shl     Yom_rev    Yom_cha      Yom_shi    Shabat 
  3: ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
     rav      som     man        bud       bra           shu        sha      
  3: vasárnap hétfö kedd szerda csütörtök péntek szombat
     vas      hét   ked  sze    csü       pén    szo     
  2: Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
     Su         Má        ╞r          Mi           Fi          FÖ         La          
  2: sundio lundio mardio merkurdio jovdio venerdio saturdio
     su     lu     ma     me        jo     ve       sa       
  3: Minggu Senin Selasa Rabu Kamis Jumat Sabtu
     Min    Sen   Sel    Rab  Kam   Jum   Sab   
  2: Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
     Do       Lu     Ma      Me        Jo     Ve      Sa      
  4: Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
     Dé_D         Dé_L     Dé_M     Dé_C        Dé_a       Dé_h      Dé_S        
  2: domenica lunedí martedí mercoledí giovedí venerdí sabato
     do       lu     ma      me        gi      ve      sa     
  2: Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
     Ni          Ge          Ka       Su        Mo         Ki         Do       
  1: Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
     I        W         H         S        M         K         T        
  7: Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
     Dies_Do       Dies_Lu   Dies_Ma     Dies_Me       Dies_Io    Dies_Ve      Dies_Sa      
  3: sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
     sve       pir      otr     tre       cet        pie       ses      
  2: Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
     Se          Pi          An          Tr            Ke             Pe           S^            
  3: Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
     Wan   Kaz     Wal     Muk    Kiw      Nna        Wam     
 12: xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
     xing-_qi-_rì xing-_qi-_yi   xing-_qi-_èr xing-_qi-_sa    xing-_qi-_sì xing-_qi-_wu   xing-_qi-_li  
  3: Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
     Jed      Jel    Jem     Jec     Jar     Jeh      Jes   
  3: Jabot Manre Juje Wonje Taije Balaire Jarere
     Jab   Man   Juj  Won   Tai   Bal     Jar    
  5: geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
     gemin      minòm     márte  mièrk     mishe     bèrna    mishá     
  2: Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
     Ah   Is    Se     Ra   Kh     Ju     Sa    
  2: sφndag mandag tirsdag onsdag torsdag fredag lφrdag
     sφ     ma     ti      on     to      fr     lφ     
  7: lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
     lo_dime    lo_dilu   lo_dima   lo_dimè      lo_dijò   lo_dive      lo_diss     
  4: djadomingo djaluna djamars djarason djaweps djabièrna djasabra
     djad       djal    djam    djar     djaw    djab      djas     
  2: Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
     Ni        Po            Wt     S,     Cz       Pi      So     
  3: Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
     Dom     seg           ter         qua          qui          sex         såb    
  1: Domingo Lunes martes Miercoles Jueves Viernes Sabado
     D       L     m      M         J      V       S      
  2: Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
     Du       Lu   Ma     Mi       Jo  Vi     Sâ      
  2: voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
     vo          po         vt      sr    ch       py        su      
  4: Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
     Sund   Di-l     Di-m     Di-c       Di-a       Di-h      Di-s        
  2: nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
     ne       po          ut     sr    cx        pe    su     
  5: Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
     Sonta   Mmant    Labob    Labor    Labon  Laboh     Moqeb    
  2: Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
     Ir      Sa         An               Ba         Br                Si          Se             
  2: nedel^a pondelok utorok streda s^tvrtok piatok sobota
     ne      po       ut     st     s^       pi     so     
  2: Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
     Ne      Po         To    Sr    Cx       Pe    So     
  2: domingo lunes martes miércoles jueves viernes sábado
     do      lu    ma     mi        ju     vi      sá     
  2: sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
     so    mu     tu         dr          fo         fr     Sa       
  7: Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
     Jumapil  Jumatat  Jumanne Jumatan  Alhamis  Ijumaa Jumamos  
  2: söndag måndag tisdag onsdag torsdag fredag lordag
     sö     må     ti     on     to      fr     lo     
  2: Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
     Li     Lu    Ma     Mi         Hu      Bi       Sa     
  6: Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
     Lé-pài     Pài-it Pài-jï Pài-sa  Pài-sì Pài-gÖ  Pài-lá  
  7: wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
     wan-ar-    wan-tja  wan-ang      wan-pho   wan-pha                   wan-soo  wan-sao 
  5: Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
     Tship  Mosup      Labob    Labor    Labon  Labot      Matlh     
  6: Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
     Pazar Pazart    Sali Çar,sa    Per,se    Cuma Cumart    
  2: nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
     ne      po        vi       se     ch      py         su     
  8: Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
     Chu?_Nhâ   Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'  Thú*_Sáu Thú*_Ba?  
  6: dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
     dydd_S   dyds_L    dydd_M      dyds_M       dydd_I   dydd_G      dyds_S      
  3: Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
     Dib    Alt    Tal     All     Al_      Alj    Gaa  
  7: iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
     iCawa uMvulo uLwesib    uLwesit      uLuwesi   uLwesih     uMgqibe   
  2: zuntik montik dinstik mitvokh donershtik fraytik shabes
     zu     mo     di      mi      do         fr      sh     
  7: iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
     iSonto uMsombu     uLwesib    uLwesit      uLwesin  uLwesih     uMgqibe   
  7: Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
     Dies_Do       Dies_Lu   Dies_Ma     Dies_Me       Dies_Io    Dies_Ve      Dies_Sa      
 11: Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
     Bazar_gÜnÜ Bazar_ærtæs  Çærs,ænbæ_a       Çærs,ænbæ_g    CÜmæ_axs,am  CÜmæ_gÜnÜ CÜmæ_Senbæ 
  2: Sun Moon Mars Mercury Jove Venus Saturn
     Su  Mo   Ma   Me      Jo   Ve    Sa     
  2: zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
     zo     ma      di      wo       do        vr      za       
  2: KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
     Ko       Gy      Be      Ku     YO       Fe     Me      
  5: Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
     Sonnt   Monta  Diens    Mittw    Donne      Freit   Sonna     
  1: Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
     D       L    T           C           X     V      S      
  7: Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
     Dies_So    Dies_Lu    Dies_Ma     Dies_Me       Dies_Io    Dies_Ve      Dies_Sa       
 12: xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
     xing-_qi-_ti   xing-_qi-_yi   xing-_qi-_èr xing-_qi-_sa    xing-_qi-_sì xing-_qi-_wu   xing-_qi-_li  
  4: djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
     djad       djal    djam    djar     djaw    djab      djas     
  2: Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau
     Ki        At      Qu           Il         Ch         Ku         In      

Python

Imperative

Works with: Python version 3.6
Translation of: Kotlin
def shortest_abbreviation_length(line, list_size):
    words = line.split()
    word_count = len(words)
    # Can't give true answer with unexpected number of entries
    if word_count != list_size:
        raise ValueError(f'Not enough entries, expected {list_size} found {word_count}')

    # Find the small slice length that gives list_size unique values
    abbreviation_length = 1
    abbreviations = set()
    while(True):
        abbreviations = {word[:abbreviation_length] for word in words}
        if len(abbreviations) == list_size:
            return abbreviation_length
        abbreviation_length += 1
        abbreviations.clear()

def automatic_abbreviations(filename, words_per_line):
    with open(filename) as file:
        for line in file:
            line = line.rstrip()
            if len(line) > 0:
                length = shortest_abbreviation_length(line, words_per_line)
                print(f'{length:2} {line}')
            else:
                print()

automatic_abbreviations('daysOfWeek.txt', 7)
Output:
 2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2 domingu llunes martes miércoles xueves vienres sábadu
 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

 7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2 dimanche lundi mardi mercredi jeudi vendredi samedi
 4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3 vasárnap hétfö kedd szerda csütörtök péntek szombat
 2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2 sundio lundio mardio merkurdio jovdio venerdio saturdio
 3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2 domenica lunedí martedí mercoledí giovedí venerdí sabato
 2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3 Jabot Manre Juje Wonje Taije Balaire Jarere
 5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2 domingo lunes martes miércoles jueves viernes sábado
 2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2 söndag måndag tisdag onsdag torsdag fredag lordag
 2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2 zuntik montik dinstik mitvokh donershtik fraytik shabes
 7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2 Sun Moon Mars Mercury Jove Venus Saturn
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Functional

In terms of generators:

import operator
from itertools import (accumulate,
                       repeat)
from pathlib import Path
from typing import (Iterator,
                    List,
                    Tuple)


FILEPATH = Path('days_of_week.txt')


def read_lines(path: Path) -> Iterator[str]:
    with path.open() as file:
        yield from file


def cumulative_letters(word: str) -> Iterator[str]:
    """For a word 'foo' yields 'f', 'fo', 'foo', 'foo', 'foo', ..."""
    yield from accumulate(word, operator.add)
    yield from repeat(word)


def words_cumulative_letters(words: List[str]) -> Iterator[Tuple[str, ...]]:
    """Yields cumulative letters for several words at the same time"""
    yield from zip(*map(cumulative_letters, words))


def longest_string_length(strings: Tuple[str, ...]) -> int:
    return max(map(len, strings))


def min_abbreviation_length(words: List[str]) -> int:
    def are_unique(abbreviations: Tuple[str, ...]) -> bool:
        return len(set(abbreviations)) == len(words)

    unique_abbreviations = filter(are_unique, words_cumulative_letters(words))

    return longest_string_length(next(unique_abbreviations))


def main():
    for line in read_lines(FILEPATH):
        words = line.split()
        if not words:
            print()
            continue

        count = min_abbreviation_length(words)
        print(f'{count} {line}', end='')


if __name__ == '__main__':
    main()
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2 dimanche lundi mardi mercredi jeudi vendredi samedi
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3 vasárnap hétfö kedd szerda csütörtök péntek szombat
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
2 sundio lundio mardio merkurdio jovdio venerdio saturdio
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2 domenica lunedí martedí mercoledí giovedí venerdí sabato
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3 Jabot Manre Juje Wonje Taije Balaire Jarere
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2 domingo lunes martes miércoles jueves viernes sábado
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2 söndag måndag tisdag onsdag torsdag fredag lordag
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2 zuntik montik dinstik mitvokh donershtik fraytik shabes
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2 Sun Moon Mars Mercury Jove Venus Saturn
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau


Composition of existing generics – just one new function. (An optimisation for higher levels of code reuse, faster code development, and easier refactoring).

The generic primitives are curried, allowing for more flexible composition:

Works with: Python version 3
'''Automatic abbreviations'''

from itertools import (accumulate, chain)
from os.path import expanduser


# abbrevLen :: [String] -> Int
def abbrevLen(xs):
    '''The minimum length of prefix required to obtain
       a unique abbreviation for each string in xs.'''
    n = len(xs)

    return next(
        len(a[0]) for a in map(
            compose(nub)(map_(concat)),
            transpose(list(map(inits, xs)))
        ) if n == len(a)
    )


# TEST ----------------------------------------------------
def main():
    '''Test'''

    xs = map_(strip)(
        lines(readFile('weekDayNames.txt'))
    )
    for i, n in enumerate(map(compose(abbrevLen)(words), xs)):
        print(n, '  ', xs[i])


# GENERIC -------------------------------------------------

# compose (<<<) :: (b -> c) -> (a -> b) -> a -> c
def compose(g):
    '''Function composition.'''
    return lambda f: lambda x: g(f(x))


# concat :: [String] -> String
def concat(xs):
    '''The concatenation of a list of strings.'''
    return ''.join(xs)


# inits :: [a] -> [[a]]
def inits(xs):
    '''all initial segments of xs, shortest first.'''
    return list(scanl(lambda a, x: a + [x])(
        []
    )(list(xs)))


# lines :: String -> [String]
def lines(s):
    '''A list of strings,
       (containing no newline characters)
       derived from a single new-line delimited string.'''
    return s.splitlines()


# map :: (a -> b) -> [a] -> [b]
def map_(f):
    '''The list obtained by applying f
       to each element of xs.'''
    return lambda xs: list(map(f, xs))


# nub :: [a] -> [a]
def nub(xs):
    '''A list containing the same elements as xs,
       without duplicates, in the order of their
       first occurrence.'''
    return list(dict.fromkeys(xs))


# readFile :: FilePath -> IO String
def readFile(fp):
    '''The contents of any file at the path
       derived by expanding any ~ in fp.'''
    with open(expanduser(fp), 'r', encoding='utf-8') as f:
        return f.read()


# scanl :: (b -> a -> b) -> b -> [a] -> [b]
def scanl(f):
    '''scanl is like reduce, but returns a succession of
       intermediate values, building from the left.'''
    return lambda a: lambda xs: (
        accumulate(chain([a], xs), f)
    )


# strip :: String -> String
def strip(s):
    '''A copy of s without any leading or trailling
       white space.'''
    return s.strip()


# transpose :: Matrix a -> Matrix a
def transpose(m):
    '''The rows and columns of the argument transposed.
       (The matrix containers and rows can be lists or tuples).'''
    if m:
        inner = type(m[0])
        z = zip(*m)
        return (type(m))(
            map(inner, z) if tuple != inner else z
        )
    else:
        return m


# words :: String -> [String]
def words(s):
    '''A list of words delimited by characters
       representing white space.'''
    return s.split()


# MAIN ---
if __name__ == '__main__':
    main()
Output:
2    Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2    Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4    E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2    Ehud Segno Maksegno Erob Hamus Arbe Kedame
5    Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4    Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2    domingu llunes martes miércoles xueves vienres sábadu
2    Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6    Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4    Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2    Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5    Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2    nedelia ponedelnik vtornik sriada chetvartak petak sabota

R

library(stringi)

abbrev <- function(w) {
  w1 <- stri_split_fixed(w," ") %>% unlist()
  if (length(w1) != 7) stop("Error: not enough days in the week.")
  maxv <- max(sapply(w1,\(x) nchar(x)))
  for (i in 1:maxv) {
    tl <- stri_sub(w1,1,i) %>% unique() %>% length()
    if (tl == 7) return(i)
  }
}

# Main 
lines <- readLines("daysOfWeek.txt")
for (l in lines) {
  if (nchar(l) == 0) {
    cat("\n")
  } else {
    cat(paste(abbrev(l),l),"\n")
  }
}
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday 
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag 
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë 
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame 
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit 
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat 
2 domingu llunes martes miércoles xueves vienres sábadu 
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn 
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat 
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar 
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota 
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn 
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota 
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk 
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte 
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee 
6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn 
2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi 
2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota 
2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota 
2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee 
2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag 
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag 
2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato 
1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev 

7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata 
2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur 
2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh 
2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai 
2 dimanche lundi mardi mercredi jeudi vendredi samedi 
4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon 
2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado 
2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati 
2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag 
2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato 
3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar 
6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono 
7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat 
3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar 
3 vasárnap hétfö kedd szerda csütörtök péntek szombat 
2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur 
2 sundio lundio mardio merkurdio jovdio venerdio saturdio 
3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu 
2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato 
4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn 
2 domenica lunedí martedí mercoledí giovedí venerdí sabato 
2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi 
1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il 
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni 
3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien 
2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis 
3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi 
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù 
3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam 
3 Jabot Manre Juje Wonje Taije Balaire Jarere 
5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro 
2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu 
2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag 
7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte 
4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra 
2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota 
3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado 
1 Domingo Lunes martes Miercoles Jueves Viernes Sabado 
2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª 
2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota 
4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne 
2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota 
5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo 
2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha- 
2 nedel^a pondelok utorok streda s^tvrtok piatok sobota 
2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota 
2 domingo lunes martes miércoles jueves viernes sábado 
2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday 
7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi 
2 söndag måndag tisdag onsdag torsdag fredag lordag 
2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado 
6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák 
7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao 
5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso 
6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi 
2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota 
8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y 
6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn 
3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw 
7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo 
2 zuntik montik dinstik mitvokh donershtik fraytik shabes 
7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo 
7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni 
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ 
2 Sun Moon Mars Mercury Jove Venus Saturn 
2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag 
2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa 
5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend 
1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado 
7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum 
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù 
4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra 
2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau 

Racket

#lang racket

(require racket/set)

(define (abbr-length ss)
  (for*/first ((l (in-range 1 (string-length (argmax string-length ss))))
               #:when (equal? (sequence-length
                               (for/set ((s ss))
                                 (substring s 0 (min l (string-length s)))))
                              (length ss)))
    l))

(module+ main
  (define report-line
    (match-lambda
      ["" ""]
      [(and s (app string-split ss)) (format "~a ~a" (abbr-length ss) s)]))
  (for-each (compose displayln report-line) (take (file->lines "data.txt") 5)))
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit

Raku

(formerly Perl 6)

Works with: Rakudo version 2017.08

Saving the "Days of Week, Also Known As" table to a local file DoWAKA.txt. Lines that have duplicate day names will get ∞ as the minimum number of characters, as there is no amount of characters that can be entered to distinguish the days uniquely. It is somewhat unclear as to what is meant by "return a null string". I have chosen to return Nil.

Note that this is using a previous version of the date file that has erroneous duplicate day names (see line 90). Since the effort was already expended to catch such problems, it may as well be demonstrated.

sub auto-abbreviate ( Str $string ) {
    return Nil unless my @words = $string.words;
    return $_ if @words».substr(0, $_).Set == @words for 1 .. @words».chars.max;
    return '∞';
}

# Testing
 say ++$, ') ', .&auto-abbreviate, '  ', $_ for './DoWAKA.txt'.IO.lines;
Output:
1) 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2) 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
3) 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
4) 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
5) 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
6) 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
7) 2  domingu llunes martes miércoles xueves vienres sábadu
8) 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
9) 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
10) 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
11) 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
12) 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
13) 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
14) 13  sing_kei_yath sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
15) 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16) 16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
17) 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
18) 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
19) 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
20) 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
21) 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
22) 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
23) 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
24) 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
25) 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
26) Nil  
27) 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
28) 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
29) 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
30) 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
31) 2  dimanche lundi mardi mercredi jeudi vendredi samedi
32) 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
33) 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
34) 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
35) 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
36) 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
37) 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
38) 6  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
39) 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
40) 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
41) 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
42) 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
43) 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
44) 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
45) 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
46) 4  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
47) 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
48) 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
49) 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
50) 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
51) 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
52) 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
53) 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
54) 12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
55) 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
56) 3  Jabot Manre Juje Wonje Taije Balaire Jarere
57) 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
58) 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
59) 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
60) 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
61) 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
62) 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
63) 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
64) 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
65) 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
66) 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
67) 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
68) 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
69) 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
70) 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
71) 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
72) 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
73) 2  domingo lunes martes miércoles jueves viernes sábado
74) 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
75) 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
76) 2  söndag måndag tisdag onsdag torsdag fredag lordag
77) 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
78) 6  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
79) 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
80) 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
81) 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
82) 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
83) 8  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
84) 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
85) 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
86) 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
87) 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
88) 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
89) 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
90) ∞  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_gÜnÜ
91) 2  Sun Moon Mars Mercury Jove Venus Saturn
92) 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
93) 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
94) 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
95) 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
96) 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
97) 12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
98) 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
99) 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Red

Red []
;; read and convert data to a string - to char conversion is neccessary to avoid
;; illegal utf8 encoding error....

data: collect/into [foreach b read/binary %abbrev.txt [keep to-char b ]] ""
                                           ;; data: read %abbrev.txt - would work, if file was utf-8 encoded ...
foreach line split data newline [           ;; split data in lines at carriage return & line feed:

 if  empty?  trim line [ continue ]         ;; continues at head of loop

 arr: split line space                      ;; now split line in words ; accumulate in array / series
 
 min: 1                                     ;; preset min length 
 until [
                                            ;; head is the first position of series
   if head? arr [m: make map! [] ]          ;; define an empty map (key -value store)
   
   abbr: copy/part first arr min            ;; copy/part ~  leftstr of first word with length min 

   arr: either m/:abbr [                    ;; abbreviation already exists ?        
        min: min + 1
        head arr                            ;; reset series position to head 
      ][                                    ;; otherwise ....
        m/:abbr: true                       ;; mark abreviation in map as existent
        next arr                            ;; set series position to next word
      ]
  tail? arr                                 ;; this is the until condition , end /tail of  series reached ?
 ]
 print [min line]                           ;; print automatically reduces all words in block
]
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
...

REXX

 /*REXX program finds the minimum length abbreviation for a lists of words (from a file).*/
iFID= 'ABBREV_A.TAB'                        /*name of the file that has the table.  */
Say 'minimum'                               /*display the first part of the title.  */
Say 'abbrev' center('days of the week',80)  /*display the title for the output.     */
Say '------' center('',80,'-')              /*display separator for the title line. */
                                            /* process the file until done.         */
Do While lines(iFID)\==0
  days=linein(iFID)                         /* read a line (should contain 7 words).*/
  If days='' Then                           /* check for a blank line or null line. */
    Say ''
  Else Do
    minLen=abb(days)                        /*find the minimum abbreviation length. */
    Say right(minLen,4) '  ' days           /*display a somewhat formatted output.  */
    If minlen='????' Then
      Say '           >>> No unique abbreviation found <<<'
    End
  End
Exit                                        /*stick a fork in it,we're all done.    */
/*----------------------------------------------------------------------------------*/
abb: Procedure
  Parse Arg daylist                         /* obtain list of words                 */
  dayn=words(daylist)                       /* find how many.                       */
  day.=''                                   /*day. is a stemmed array of the words. */
  L=0                                       /*L    is the max length  of the words. */
  Do j=1 for dayn
    day.j=word(daylist,j)                   /*assign to array for faster processing */
    L.j=length(day.j)
    L= max(L,L.j)                           /* find the maximum length of any item. */
    End
                                            /* [?]  determine minimum abbrev length */
  Do m=1 To L
    abblist=''                              /* for all lengths,find a unique abbrev  */
    Do k=1 to dayn
      abbrev=strip(left(day.k,m))           /* get an abbreviation (with length  M). */
      If wordpos(abbrev,abblist)>0 Then     /* not unique                            */
        Iterate M                           /* try next length                       */
      If length(abbrev)>=m Then
        abblist=abblist abbrev              /* so far,it's unique add to the list.   */
      End
    leave                                   /* a good abbreviation length was found. */
    End
  If m>L Then                               /* no unique abbreviation length found   */
    m='????'
  Return m
output   when using the default input file containing the complete list of words:
minimum
abbrev                                 days of the week
══════ ════════════════════════════════════════════════════════════════════════════════
   2    Sunday Monday Tuesday Wednesday Thursday Friday Saturday
   2    Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
   4    E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
   2    Ehud Segno Maksegno Erob Hamus Arbe Kedame
   5    Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
   4    Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
   2    domingu llunes martes miércoles xueves vienres sábadu
   2    Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
   6    Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
   4    Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
   2    Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
   5    Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
   2    nedelia ponedelnik vtornik sriada chetvartak petak sabota
   4    Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
  12    sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
  16    Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
   6    dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
   2    Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
   2    nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
   2    nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
   2    Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
   2    s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
   2    zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
   2    Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
   1    pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

   7    Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
   2    sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
   2    Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
   2    sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
   2    dimanche lundi mardi mercredi jeudi vendredi samedi
   4    Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
   2    Domingo Segunda_feira Martes Mércores Joves Venres Sábado
   2    k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
   2    Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
   2    Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
   3    ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
   6    pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
   7    Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
   3    ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
   3    vasárnap hétfö kedd szerda csütörtök péntek szombat
   2    Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
   2    sundio lundio mardio merkurdio jovdio venerdio saturdio
   3    Minggu Senin Selasa Rabu Kamis Jumat Sabtu
   2    Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
   4    Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
   2    domenica lunedí martedí mercoledí giovedí venerdí sabato
   2    Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
   1    Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
   7    Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
   3    sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
   2    Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
   3    Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
  12    xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
   3    Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
   3    Jabot Manre Juje Wonje Taije Balaire Jarere
   5    geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
   2    Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
   2    sφndag mandag tirsdag onsdag torsdag fredag lφrdag
   7    lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
   4    djadomingo djaluna djamars djarason djaweps djabièrna djasabra
   2    Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
   3    Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
   1    Domingo Lunes martes Miercoles Jueves Viernes Sabado
   2    Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
   2    voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
   4    Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
   2    nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
   5    Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
   2    Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
   2    nedel^a pondelok utorok streda s^tvrtok piatok sobota
   2    Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
   2    domingo lunes martes miércoles jueves viernes sábado
   2    sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
   7    Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
   2    söndag måndag tisdag onsdag torsdag fredag lordag
   2    Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
   6    Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
   7    wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
   5    Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
   6    Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
   2    nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
   8    Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
   6    dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
   3    Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
   7    iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
   2    zuntik montik dinstik mitvokh donershtik fraytik shabes
   7    iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
   7    Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
  11    Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
   2    Sun Moon Mars Mercury Jove Venus Saturn
   2    zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
   2    KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
   5    Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
   1    Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
   7    Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
  12    xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
   4    djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
   2    Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Ruby

require "abbrev" 
 
File.read("daynames.txt").each_line do |line|
  next if line.strip.empty?
  abbr = line.split.abbrev.invert
  puts "Minimum size: #{abbr.values.max_by(&:size).size}", abbr.inspect, "\n"
end
Output:
Minimum size: 2
{"Sunday"=>"Su", "Monday"=>"M", "Tuesday"=>"Tu", "Wednesday"=>"W", "Thursday"=>"Th", "Friday"=>"F", "Saturday"=>"Sa"}

Minimum size: 2
{"Sondag"=>"So", "Maandag"=>"M", "Dinsdag"=>"Di", "Woensdag"=>"W", "Donderdag"=>"Do", "Vrydag"=>"V", "Saterdag"=>"Sa"}

Minimum size: 4
{"E_djelë"=>"E_d", "E_hënë"=>"E_h", "E_martë"=>"E_ma", "E_mërkurë"=>"E_më", "E_enjte"=>"E_e", "E_premte"=>"E_p", "E_shtunë"=>"E_s"}

Minimum size: 2
{"Ehud"=>"Eh", "Segno"=>"S", "Maksegno"=>"M", "Erob"=>"Er", "Hamus"=>"H", "Arbe"=>"A", "Kedame"=>"K"}

Minimum size: 5
{"Al_Ahad"=>"Al_Ah", "Al_Ithinin"=>"Al_I", "Al_Tholatha'a"=>"Al_T", "Al_Arbia'a"=>"Al_Ar", "Al_Kamis"=>"Al_K", "Al_Gomia'a"=>"Al_G", "Al_Sabit"=>"Al_S"}

Minimum size: 4
{"Guiragui"=>"G", "Yergou_shapti"=>"Yerg", "Yerek_shapti"=>"Yere", "Tchorek_shapti"=>"T", "Hink_shapti"=>"H", "Ourpat"=>"O", "Shapat"=>"S"}

Minimum size: 2
{"domingu"=>"d", "llunes"=>"l", "martes"=>"ma", "miércoles"=>"mi", "xueves"=>"x", "vienres"=>"v", "sábadu"=>"s"}

Minimum size: 2
{"Bazar_gÜnÜ"=>"Ba", "Birinci_gÜn"=>"Bi", "Çkinci_gÜn"=>"Ç", "ÜçÜncÜ_gÜn"=>"Ü", "DÖrdÜncÜ_gÜn"=>"D", "Bes,inci_gÜn"=>"Be", "Altòncò_gÜn"=>"A"}

Minimum size: 6
{"Igande"=>"I", "Astelehen"=>"Astel", "Astearte"=>"Astear", "Asteazken"=>"Asteaz", "Ostegun"=>"Oste", "Ostiral"=>"Osti", "Larunbat"=>"L"}

Minimum size: 4
{"Robi_bar"=>"R", "Shom_bar"=>"Shom", "Mongal_bar"=>"M", "Budhh_bar"=>"Bu", "BRihashpati_bar"=>"BR", "Shukro_bar"=>"Shu", "Shoni_bar"=>"Shon"}
(...)

Rust

/**
 * Abbreviations from tintenalarm.de
 */
use std::fs::File;
use std::io;
use std::io::{BufRead, BufReader};

fn main() {
    let table = read_days("weekdays.txt").expect("Error in Function read_days:");
    for line in table {
        if line.len() == 0 {
            continue;
        };
        let mut max_same = 0;
        for i in 0..(line.len() - 1) {
            for j in i + 1..line.len() {
                max_same = max_same.max(begins_with_num_same_chars(&line[i], &line[j]));
            }
        }
        println!("{}\t{:?}", max_same + 1, line);
    }
}

fn read_days(filename: &str) -> io::Result<Vec<Vec<String>>> {
    let f = File::open(filename)?;
    let reader = BufReader::new(f);
    let mut table: Vec<Vec<String>> = Vec::new();
    for line in reader.lines() {
        let mut days: Vec<String> = Vec::with_capacity(7);
        for day in line?.split_whitespace() {
            days.push(day.to_string());
        }
        table.push(days);
    }
    Ok(table)
}

fn begins_with_num_same_chars(str_a: &str, str_b: &str) -> u32 {
    let mut num = 0;
    for (pos, char_a) in str_a.chars().enumerate() {
        match str_b.chars().nth(pos) {
            Some(char_b) => {
                if char_a == char_b {
                    num = num + 1;
                } else {
                    return num;
                }
            }
            None => return num,
        }
    }
    num
}
Output:
2       ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
2       ["Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag"]
4       ["E_djelë", "E_hënë", "E_martë", "E_mërkurë", "E_enjte", "E_premte", "E_shtunë"]
2       ["Ehud", "Segno", "Maksegno", "Erob", "Hamus", "Arbe", "Kedame"]
5       ["Al_Ahad", "Al_Ithinin", "Al_Tholatha\'a", "Al_Arbia\'a", "Al_Kamis", "Al_Gomia\'a", "Al_Sabit"]
4       ["Guiragui", "Yergou_shapti", "Yerek_shapti", "Tchorek_shapti", "Hink_shapti", "Ourpat", "Shapat"]
2       ["domingu", "llunes", "martes", "miércoles", "xueves", "vienres", "sábadu"]
2       ["Bazar_gÜnÜ", "Birinci_gÜn", "Çkinci_gÜn", "ÜçÜncÜ_gÜn", "DÖrdÜncÜ_gÜn", "Bes,inci_gÜn", "Altòncò_gÜn"]
6       ["Igande", "Astelehen", "Astearte", "Asteazken", "Ostegun", "Ostiral", "Larunbat"]
4       ["Robi_bar", "Shom_bar", "Mongal_bar", "Budhh_bar", "BRihashpati_bar", "Shukro_bar", "Shoni_bar"]
2       ["Nedjelja", "Ponedeljak", "Utorak", "Srijeda", "Cxetvrtak", "Petak", "Subota"]
5       ["Disul", "Dilun", "Dimeurzh", "Dimerc\'her", "Diriaou", "Digwener", "Disadorn"]
2       ["nedelia", "ponedelnik", "vtornik", "sriada", "chetvartak", "petak", "sabota"]
12      ["sing_kei_yaht", "sing_kei_yat", "sing_kei_yee", "sing_kei_saam", "sing_kei_sie", "sing_kei_ng", "sing_kei_luk"]
4       ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
16      ["Dzeenkk-eh", "Dzeehn_kk-ehreh", "Dzeehn_kk-ehreh_nah_kay_dzeeneh", "Tah_neesee_dzeehn_neh", "Deehn_ghee_dzee-neh", "Tl-oowey_tts-el_dehlee", "Dzeentt-ahzee"]
6       ["dy_Sul", "dy_Lun", "dy_Meurth", "dy_Mergher", "dy_You", "dy_Gwener", "dy_Sadorn"]
2       ["Dimanch", "Lendi", "Madi", "Mèkredi", "Jedi", "Vandredi", "Samdi"]
2       ["nedjelja", "ponedjeljak", "utorak", "srijeda", "cxetvrtak", "petak", "subota"]
2       ["nede^le", "ponde^lí", "úterÿ", "str^eda", "c^tvrtek", "pátek", "sobota"]
2       ["Sondee", "Mondee", "Tiisiday", "Walansedee", "TOOsedee", "Feraadee", "Satadee"]
2       ["s0ndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "l0rdag"]
2       ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
2       ["Diman^co", "Lundo", "Mardo", "Merkredo", "^Jaùdo", "Vendredo", "Sabato"]
1       ["pÜhapäev", "esmaspäev", "teisipäev", "kolmapäev", "neljapäev", "reede", "laupäev"]
7       ["Diu_prima", "Diu_sequima", "Diu_tritima", "Diu_quartima", "Diu_quintima", "Diu_sextima", "Diu_sabbata"]
2       ["sunnudagur", "mánadagur", "tÿsdaguy", "mikudagur", "hósdagur", "friggjadagur", "leygardagur"]
2       ["Yek_Sham\'beh", "Do_Sham\'beh", "Seh_Sham\'beh", "Cha\'har_Sham\'beh", "Panj_Sham\'beh", "Jom\'eh", "Sham\'beh"]
2       ["sunnuntai", "maanantai", "tiistai", "keskiviiko", "torsktai", "perjantai", "lauantai"]
2       ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
4       ["Snein", "Moandei", "Tiisdei", "Woansdei", "Tonersdei", "Freed", "Sneon"]
2       ["Domingo", "Segunda_feira", "Martes", "Mércores", "Joves", "Venres", "Sábado"]
2       ["k\'vira", "orshabati", "samshabati", "otkhshabati", "khutshabati", "p\'arask\'evi", "shabati"]
2       ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
2       ["Kiriaki\'", "Defte\'ra", "Tri\'ti", "Teta\'rti", "Pe\'mpti", "Paraskebi\'", "Sa\'bato"]
3       ["ravivaar", "somvaar", "mangalvaar", "budhvaar", "guruvaar", "shukravaar", "shanivaar"]
6       ["pópule", "pó`akahi", "pó`alua", "pó`akolu", "pó`ahá", "pó`alima", "pó`aono"]
7       ["Yom_rishon", "Yom_sheni", "Yom_shlishi", "Yom_revi\'i", "Yom_chamishi", "Yom_shishi", "Shabat"]
3       ["ravivara", "somavar", "mangalavar", "budhavara", "brahaspativar", "shukravara", "shanivar"]
3       ["vasárnap", "hétfö", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
2       ["Sunnudagur", "Mánudagur", "╞riδjudagur", "Miδvikudagar", "Fimmtudagur", "FÖstudagur", "Laugardagur"]
2       ["sundio", "lundio", "mardio", "merkurdio", "jovdio", "venerdio", "saturdio"]
3       ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
2       ["Dominica", "Lunedi", "Martedi", "Mercuridi", "Jovedi", "Venerdi", "Sabbato"]
4       ["Dé_Domhnaigh", "Dé_Luain", "Dé_Máirt", "Dé_Ceadaoin", "Dé_ardaoin", "Dé_hAoine", "Dé_Sathairn"]
2       ["domenica", "lunedí", "martedí", "mercoledí", "giovedí", "venerdí", "sabato"]
2       ["Nichiyou_bi", "Getzuyou_bi", "Kayou_bi", "Suiyou_bi", "Mokuyou_bi", "Kin\'you_bi", "Doyou_bi"]
1       ["Il-yo-il", "Wol-yo-il", "Hwa-yo-il", "Su-yo-il", "Mok-yo-il", "Kum-yo-il", "To-yo-il"]
7       ["Dies_Dominica", "Dies_Lunæ", "Dies_Martis", "Dies_Mercurii", "Dies_Iovis", "Dies_Veneris", "Dies_Saturni"]
3       ["sve-tdien", "pirmdien", "otrdien", "tresvdien", "ceturtdien", "piektdien", "sestdien"]
2       ["Sekmadienis", "Pirmadienis", "Antradienis", "Trec^iadienis", "Ketvirtadienis", "Penktadienis", "S^es^tadienis"]
3       ["Wangu", "Kazooba", "Walumbe", "Mukasa", "Kiwanuka", "Nnagawonye", "Wamunyi"]
12      ["xing-_qi-_rì", "xing-_qi-_yi-.", "xing-_qi-_èr", "xing-_qi-_san-.", "xing-_qi-_sì", "xing-_qi-_wuv.", "xing-_qi-_liù"]
3       ["Jedoonee", "Jelune", "Jemayrt", "Jecrean", "Jardaim", "Jeheiney", "Jesam"]
3       ["Jabot", "Manre", "Juje", "Wonje", "Taije", "Balaire", "Jarere"]
5       ["geminrongo", "minòmishi", "mártes", "mièrkoles", "misheushi", "bèrnashi", "mishábaro"]
2       ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu"]
2       ["sφndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lφrdag"]
7       ["lo_dimenge", "lo_diluns", "lo_dimarç", "lo_dimèrcres", "lo_dijòus", "lo_divendres", "lo_dissabte"]
4       ["djadomingo", "djaluna", "djamars", "djarason", "djaweps", "djabièrna", "djasabra"]
2       ["Niedziela", "Poniedzial/ek", "Wtorek", "S,roda", "Czwartek", "Pia,tek", "Sobota"]
3       ["Domingo", "segunda-feire", "terça-feire", "quarta-feire", "quinta-feire", "sexta-feira", "såbado"]
1       ["Domingo", "Lunes", "martes", "Miercoles", "Jueves", "Viernes", "Sabado"]
2       ["Duminicª", "Luni", "Mart\'i", "Miercuri", "Joi", "Vineri", "Sâmbªtª"]
2       ["voskresenie", "ponedelnik", "vtornik", "sreda", "chetverg", "pyatnitsa", "subbota"]
4       ["Sunday", "Di-luain", "Di-màirt", "Di-ciadain", "Di-ardaoin", "Di-haoine", "Di-sathurne"]
2       ["nedjelja", "ponedjeljak", "utorak", "sreda", "cxetvrtak", "petak", "subota"]
5       ["Sontaha", "Mmantaha", "Labobedi", "Laboraro", "Labone", "Labohlano", "Moqebelo"]
2       ["Iridha-", "Sandhudha-", "Anga.haruwa-dha-", "Badha-dha-", "Brahaspa.thindha-", "Sikura-dha-", "Sena.sura-dha-"]
2       ["nedel^a", "pondelok", "utorok", "streda", "s^tvrtok", "piatok", "sobota"]
2       ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Cxetrtek", "Petek", "Sobota"]
2       ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"]
2       ["sonde", "mundey", "tude-wroko", "dride-wroko", "fode-wroko", "freyda", "Saturday"]
7       ["Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi"]
2       ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lordag"]
2       ["Linggo", "Lunes", "Martes", "Miyerkoles", "Huwebes", "Biyernes", "Sabado"]
6       ["Lé-pài-jít", "Pài-it", "Pài-jï", "Pài-sañ", "Pài-sì", "Pài-gÖ.", "Pài-lák"]
7       ["wan-ar-tit", "wan-tjan", "wan-ang-kaan", "wan-phoet", "wan-pha-ru-hat-sa-boh-die", "wan-sook", "wan-sao"]
5       ["Tshipi", "Mosupologo", "Labobedi", "Laboraro", "Labone", "Labotlhano", "Matlhatso"]
6       ["Pazar", "Pazartesi", "Sali", "Çar,samba", "Per,sembe", "Cuma", "Cumartesi"]
2       ["nedilya", "ponedilok", "vivtorok", "sereda", "chetver", "pyatnytsya", "subota"]
8       ["Chu?_Nhâ.t", "Thú*_Hai", "Thú*_Ba", "Thú*_Tu*", "Thú*_Na\'m", "Thú*_Sáu", "Thú*_Ba?y"]
6       ["dydd_Sul", "dyds_Llun", "dydd_Mawrth", "dyds_Mercher", "dydd_Iau", "dydd_Gwener", "dyds_Sadwrn"]
3       ["Dibeer", "Altine", "Talaata", "Allarba", "Al_xebes", "Aljuma", "Gaaw"]
7       ["iCawa", "uMvulo", "uLwesibini", "uLwesithathu", "uLuwesine", "uLwesihlanu", "uMgqibelo"]
2       ["zuntik", "montik", "dinstik", "mitvokh", "donershtik", "fraytik", "shabes"]
7       ["iSonto", "uMsombuluko", "uLwesibili", "uLwesithathu", "uLwesine", "uLwesihlanu", "uMgqibelo"]
7       ["Dies_Dominica", "Dies_Lunæ", "Dies_Martis", "Dies_Mercurii", "Dies_Iovis", "Dies_Veneris", "Dies_Saturni"]
11      ["Bazar_gÜnÜ", "Bazar_ærtæsi", "Çærs,ænbæ_axs,amò", "Çærs,ænbæ_gÜnÜ", "CÜmæ_axs,amò", "CÜmæ_gÜnÜ", "CÜmæ_Senbæ"]
2       ["Sun", "Moon", "Mars", "Mercury", "Jove", "Venus", "Saturn"]
2       ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
2       ["KoseEraa", "GyoOraa", "BenEraa", "Kuoraa", "YOwaaraa", "FeEraa", "Memenaa"]
5       ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Sonnabend"]
1       ["Domingo", "Luns", "Terza_feira", "Corta_feira", "Xoves", "Venres", "Sábado"]
7       ["Dies_Solis", "Dies_Lunae", "Dies_Martis", "Dies_Mercurii", "Dies_Iovis", "Dies_Veneris", "Dies_Sabbatum"]
12      ["xing-_qi-_tiàn", "xing-_qi-_yi-.", "xing-_qi-_èr", "xing-_qi-_san-.", "xing-_qi-_sì", "xing-_qi-_wuv.", "xing-_qi-_liù"]
4       ["djadomingu", "djaluna", "djamars", "djarason", "djaweps", "djabièrnè", "djasabra"]
2       ["Killachau", "Atichau", "Quoyllurchau", "Illapachau", "Chaskachau", "Kuychichau", "Intichau"]

Scala

Functional programmed

build.sbt

name         := "Abbreviations-automatic"
scalaVersion := "2.13.0"
version      := "0.1"

homepage     := Some(url("http://rosettacode.org/wiki/Abbreviations,_automatic#Scala"))

libraryDependencies += "com.lihaoyi" %% "os-lib" % "0.3.0"

AbbreviationsAuto.scala

object AbbreviationsAuto extends App {
  private val wd = os.pwd

  def processLine(line: String): String = {
    if (line.nonEmpty) {
      val days = line.split(' ')
      val maxL = days.map(_.length).max
      val paddedNames = days.map(s => s.padTo(maxL, ' '))

      def uniqueN = (1 to maxL) // distinct filters uniques
        .map(n => paddedNames.map(_.substring(0, n)).distinct)
        .filter(_.size == paddedNames.length)  // `.distinct` filters uniques
        .head.head.length

      f"$uniqueN%3d $line" // Return by means of String Interpolation
    } else "    \"\""
  }

  os.read.lines(wd / "days_of_week.txt")
    .distinct
    .foreach(line => println(processLine(line)))

}
Output:
    ""
  2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
  2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
  4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
  2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
  5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
  4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
  2 domingu llunes martes miércoles xueves vienres sábadu
  2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
  6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
  4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
  2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
  5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
  2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
 12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
  4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
 16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
  6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
  2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
  2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
  2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
  2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
  2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
  2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
  2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
  1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
  7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
  2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
  2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
  2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
  2 dimanche lundi mardi mercredi jeudi vendredi samedi
  4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
  2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
  2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
  2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
  2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
  3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
  6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
  7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
  3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
  3 vasárnap hétfö kedd szerda csütörtök péntek szombat
  2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
  2 sundio lundio mardio merkurdio jovdio venerdio saturdio
  3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
  2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
  4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
  2 domenica lunedí martedí mercoledí giovedí venerdí sabato
  2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
  1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
  7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
  3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
  2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
  3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
 12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
  3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
  3 Jabot Manre Juje Wonje Taije Balaire Jarere
  5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
  2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
  2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
  7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
  4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
  2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
  3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
  1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
  2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
  2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
  4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
  2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
  5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
  2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
  2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
  2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
  2 domingo lunes martes miércoles jueves viernes sábado
  2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
  7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
  2 söndag måndag tisdag onsdag torsdag fredag lordag
  2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
  6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
  7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
  5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
  6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
  2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
  8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
  6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
  3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
  7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
  2 zuntik montik dinstik mitvokh donershtik fraytik shabes
  7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
  2 Sun Moon Mars Mercury Jove Venus Saturn
  2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
  5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
  1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
  7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
 12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
  4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
  2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

SenseTalk

function AbbreviationsAutomatic days
	put 1 into abbreviationLength
	put the number of items in days into len
	repeat forever
		put () into abbreviations
		repeat with each item day in days
			put the first abbreviationLength characters of day into abbreviation
			if abbreviations contains abbreviation
				exit repeat
			end if
			insert abbreviation after abbreviations
			if the number of items in abbreviations is len
				return abbreviationLength
			end if
		end repeat
		add 1 to abbreviationLength
	end repeat
end AbbreviationsAutomatic
put "Weekdays.txt" into myFile

put the defaultStringEncoding into savedEncoding
put "WinLatin1" into the defaultStringEncoding

open file myFile

repeat forever
	read from file myFile until return
	if it is empty then exit repeat
	split trim(it) by " "
	if the number of items in it is 0
		put ""
	else
		put AbbreviationsAutomatic(it) && it
	end if
end repeat


close file myFile

put savedEncoding into the defaultStringEncoding
Output:
2 (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)
2 (Sondag,Maandag,Dinsdag,Woensdag,Donderdag,Vrydag,Saterdag)
4 (E_djelë,E_hënë,E_martë,E_mërkurë,E_enjte,E_premte,E_shtunë)
2 (Ehud,Segno,Maksegno,Erob,Hamus,Arbe,Kedame)
5 (Al_Ahad,Al_Ithinin,Al_Tholatha'a,Al_Arbia'a,Al_Kamis,Al_Gomia'a,Al_Sabit)
4 (Guiragui,Yergou_shapti,Yerek_shapti,Tchorek_shapti,Hink_shapti,Ourpat,Shapat)
2 (domingu,llunes,martes,miércoles,xueves,vienres,sábadu)
2 (Bazar_gÜnÜ,Birinci_gÜn,Çkinci_gÜn,ÜçÜncÜ_gÜn,DÖrdÜncÜ_gÜn,Bes,inci_gÜn,Altòncò_gÜn)
6 (Igande,Astelehen,Astearte,Asteazken,Ostegun,Ostiral,Larunbat)
4 (Robi_bar,Shom_bar,Mongal_bar,Budhh_bar,BRihashpati_bar,Shukro_bar,Shoni_bar)
[...]
2 (Killachau,Atichau,Quoyllurchau,Illapachau,Chaskachau,Kuychichau,Intichau)

Tcl

set f [open abbreviations_automatic_weekdays.txt]
set lines [split [read -nonewline $f] \n]
close $f

foreach days $lines {
  if {[string length $days] == 0} continue
  if {[llength $days] != 7} {
    throw ERROR {not 7 days in a line}
  }
  if {[llength [lsort -unique $days]] != 7} {
    throw ERROR {not all 7 days in a line are distinct}
  }
  for {set i 0} {1} {incr i} {
    if {[llength [lsort -unique [lmap x $days {string range $x 0 $i}]]] == 7} break
  }
  incr i
  puts "$i $days"
}
Output:
2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2 domingu llunes martes miércoles xueves vienres sábadu
2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn


Transd

#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))
   )   )   )
}
Output:
2 [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
2 [Sondag, Maandag, Dinsdag, Woensdag, Donderdag, Vrydag, Saterdag]
4 [E_djelë, E_hënë, E_martë, E_mërkurë, E_enjte, E_premte, E_shtunë]
2 [Ehud, Segno, Maksegno, Erob, Hamus, Arbe, Kedame]
5 [Al_Ahad, Al_Ithinin, Al_Tholatha'a, Al_Arbia'a, Al_Kamis, Al_Gomia'a, Al_Sabit]
4 [Guiragui, Yergou_shapti, Yerek_shapti, Tchorek_shapti, Hink_shapti, Ourpat, Shapat]
2 [domingu, llunes, martes, miércoles, xueves, vienres, sábadu]
2 [Bazar_gÜnÜ, Birinci_gÜn, Çkinci_gÜn, ÜçÜncÜ_gÜn, DÖrdÜncÜ_gÜn, Bes,inci_gÜn, Altòncò_gÜn]
6 [Igande, Astelehen, Astearte, Asteazken, Ostegun, Ostiral, Larunbat]
4 [Robi_bar, Shom_bar, Mongal_bar, Budhh_bar, BRihashpati_bar, Shukro_bar, Shoni_bar]
2 [Nedjelja, Ponedeljak, Utorak, Srijeda, Cxetvrtak, Petak, Subota]
5 [Disul, Dilun, Dimeurzh, Dimerc'her, Diriaou, Digwener, Disadorn]
2 [nedelia, ponedelnik, vtornik, sriada, chetvartak, petak, sabota]
12 [sing_kei_yaht, sing_kei_yat, sing_kei_yee, sing_kei_saam, sing_kei_sie, sing_kei_ng, sing_kei_luk]
4 [Diumenge, Dilluns, Dimarts, Dimecres, Dijous, Divendres, Dissabte]
16 [Dzeenkk-eh, Dzeehn_kk-ehreh, Dzeehn_kk-ehreh_nah_kay_dzeeneh, Tah_neesee_dzeehn_neh, Deehn_ghee_dzee-neh, Tl-oowey_tts-el_dehlee, Dzeentt-ahzee]
6 [dy_Sul, dy_Lun, dy_Meurth, dy_Mergher, dy_You, dy_Gwener, dy_Sadorn]
2 [Dimanch, Lendi, Madi, Mèkredi, Jedi, Vandredi, Samdi]
2 [nedjelja, ponedjeljak, utorak, srijeda, cxetvrtak, petak, subota]
2 [nede^le, ponde^lí, úterÿ, str^eda, c^tvrtek, pátek, sobota]
2 [Sondee, Mondee, Tiisiday, Walansedee, TOOsedee, Feraadee, Satadee]
2 [s0ndag, mandag, tirsdag, onsdag, torsdag, fredag, l0rdag]
2 [zondag, maandag, dinsdag, woensdag, donderdag, vrijdag, zaterdag]
2 [Diman^co, Lundo, Mardo, Merkredo, ^Jaùdo, Vendredo, Sabato]
1 [pÜhapäev, esmaspäev, teisipäev, kolmapäev, neljapäev, reede, laupäev]
1 []
7 [Diu_prima, Diu_sequima, Diu_tritima, Diu_quartima, Diu_quintima, Diu_sextima, Diu_sabbata]
2 [sunnudagur, mánadagur, tÿsdaguy, mikudagur, hósdagur, friggjadagur, leygardagur]
2 [Yek_Sham'beh, Do_Sham'beh, Seh_Sham'beh, Cha'har_Sham'beh, Panj_Sham'beh, Jom'eh, Sham'beh]
2 [sunnuntai, maanantai, tiistai, keskiviiko, torsktai, perjantai, lauantai]
2 [dimanche, lundi, mardi, mercredi, jeudi, vendredi, samedi]
4 [Snein, Moandei, Tiisdei, Woansdei, Tonersdei, Freed, Sneon]
2 [Domingo, Segunda_feira, Martes, Mércores, Joves, Venres, Sábado]
2 [k'vira, orshabati, samshabati, otkhshabati, khutshabati, p'arask'evi, shabati]
2 [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
2 [Kiriaki', Defte'ra, Tri'ti, Teta'rti, Pe'mpti, Paraskebi', Sa'bato]
3 [ravivaar, somvaar, mangalvaar, budhvaar, guruvaar, shukravaar, shanivaar]
6 [pópule, pó`akahi, pó`alua, pó`akolu, pó`ahá, pó`alima, pó`aono]
7 [Yom_rishon, Yom_sheni, Yom_shlishi, Yom_revi'i, Yom_chamishi, Yom_shishi, Shabat]
3 [ravivara, somavar, mangalavar, budhavara, brahaspativar, shukravara, shanivar]
3 [vasárnap, hétfö, kedd, szerda, csütörtök, péntek, szombat]
2 [Sunnudagur, Mánudagur, ╞riδjudagur, Miδvikudagar, Fimmtudagur, FÖstudagur, Laugardagur]
2 [sundio, lundio, mardio, merkurdio, jovdio, venerdio, saturdio]
3 [Minggu, Senin, Selasa, Rabu, Kamis, Jumat, Sabtu]
2 [Dominica, Lunedi, Martedi, Mercuridi, Jovedi, Venerdi, Sabbato]
4 [Dé_Domhnaigh, Dé_Luain, Dé_Máirt, Dé_Ceadaoin, Dé_ardaoin, Dé_hAoine, Dé_Sathairn]
2 [domenica, lunedí, martedí, mercoledí, giovedí, venerdí, sabato]
2 [Nichiyou_bi, Getzuyou_bi, Kayou_bi, Suiyou_bi, Mokuyou_bi, Kin'you_bi, Doyou_bi]
1 [Il-yo-il, Wol-yo-il, Hwa-yo-il, Su-yo-il, Mok-yo-il, Kum-yo-il, To-yo-il]
7 [Dies_Dominica, Dies_Lunæ, Dies_Martis, Dies_Mercurii, Dies_Iovis, Dies_Veneris, Dies_Saturni]
3 [sve-tdien, pirmdien, otrdien, tresvdien, ceturtdien, piektdien, sestdien]
2 [Sekmadienis, Pirmadienis, Antradienis, Trec^iadienis, Ketvirtadienis, Penktadienis, S^es^tadienis]
3 [Wangu, Kazooba, Walumbe, Mukasa, Kiwanuka, Nnagawonye, Wamunyi]
12 [xing-_qi-_rì, xing-_qi-_yi-., xing-_qi-_èr, xing-_qi-_san-., xing-_qi-_sì, xing-_qi-_wuv., xing-_qi-_liù]
3 [Jedoonee, Jelune, Jemayrt, Jecrean, Jardaim, Jeheiney, Jesam]
3 [Jabot, Manre, Juje, Wonje, Taije, Balaire, Jarere]
5 [geminrongo, minòmishi, mártes, mièrkoles, misheushi, bèrnashi, mishábaro]
2 [Ahad, Isnin, Selasa, Rabu, Khamis, Jumaat, Sabtu]
2 [sφndag, mandag, tirsdag, onsdag, torsdag, fredag, lφrdag]
7 [lo_dimenge, lo_diluns, lo_dimarç, lo_dimèrcres, lo_dijòus, lo_divendres, lo_dissabte]
4 [djadomingo, djaluna, djamars, djarason, djaweps, djabièrna, djasabra]
2 [Niedziela, Poniedzial/ek, Wtorek, S,roda, Czwartek, Pia,tek, Sobota]
3 [Domingo, segunda-feire, terça-feire, quarta-feire, quinta-feire, sexta-feira, såbado]
1 [Domingo, Lunes, martes, Miercoles, Jueves, Viernes, Sabado]
2 [Duminicª, Luni, Mart'i, Miercuri, Joi, Vineri, Sâmbªtª]
2 [voskresenie, ponedelnik, vtornik, sreda, chetverg, pyatnitsa, subbota]
4 [Sunday, Di-luain, Di-màirt, Di-ciadain, Di-ardaoin, Di-haoine, Di-sathurne]
2 [nedjelja, ponedjeljak, utorak, sreda, cxetvrtak, petak, subota]
5 [Sontaha, Mmantaha, Labobedi, Laboraro, Labone, Labohlano, Moqebelo]
2 [Iridha-, Sandhudha-, Anga.haruwa-dha-, Badha-dha-, Brahaspa.thindha-, Sikura-dha-, Sena.sura-dha-]
2 [nedel^a, pondelok, utorok, streda, s^tvrtok, piatok, sobota]
2 [Nedelja, Ponedeljek, Torek, Sreda, Cxetrtek, Petek, Sobota]
2 [domingo, lunes, martes, miércoles, jueves, viernes, sábado]
2 [sonde, mundey, tude-wroko, dride-wroko, fode-wroko, freyda, Saturday]
7 [Jumapili, Jumatatu, Jumanne, Jumatano, Alhamisi, Ijumaa, Jumamosi]
2 [söndag, måndag, tisdag, onsdag, torsdag, fredag, lordag]
2 [Linggo, Lunes, Martes, Miyerkoles, Huwebes, Biyernes, Sabado]
6 [Lé-pài-jít, Pài-it, Pài-jï, Pài-sañ, Pài-sì, Pài-gÖ., Pài-lák]
7 [wan-ar-tit, wan-tjan, wan-ang-kaan, wan-phoet, wan-pha-ru-hat-sa-boh-die, wan-sook, wan-sao]
5 [Tshipi, Mosupologo, Labobedi, Laboraro, Labone, Labotlhano, Matlhatso]
6 [Pazar, Pazartesi, Sali, Çar,samba, Per,sembe, Cuma, Cumartesi]
2 [nedilya, ponedilok, vivtorok, sereda, chetver, pyatnytsya, subota]
8 [Chu?_Nhâ.t, Thú*_Hai, Thú*_Ba, Thú*_Tu*, Thú*_Na'm, Thú*_Sáu, Thú*_Ba?y]
6 [dydd_Sul, dyds_Llun, dydd_Mawrth, dyds_Mercher, dydd_Iau, dydd_Gwener, dyds_Sadwrn]
3 [Dibeer, Altine, Talaata, Allarba, Al_xebes, Aljuma, Gaaw]
7 [iCawa, uMvulo, uLwesibini, uLwesithathu, uLuwesine, uLwesihlanu, uMgqibelo]
2 [zuntik, montik, dinstik, mitvokh, donershtik, fraytik, shabes]
7 [iSonto, uMsombuluko, uLwesibili, uLwesithathu, uLwesine, uLwesihlanu, uMgqibelo]
7 [Dies_Dominica, Dies_Lunæ, Dies_Martis, Dies_Mercurii, Dies_Iovis, Dies_Veneris, Dies_Saturni]
11 [Bazar_gÜnÜ, Bazar_ærtæsi, Çærs,ænbæ_axs,amò, Çærs,ænbæ_gÜnÜ, CÜmæ_axs,amò, CÜmæ_gÜnÜ, CÜmæ_Senbæ]
2 [Sun, Moon, Mars, Mercury, Jove, Venus, Saturn]
2 [zondag, maandag, dinsdag, woensdag, donderdag, vrijdag, zaterdag]
2 [KoseEraa, GyoOraa, BenEraa, Kuoraa, YOwaaraa, FeEraa, Memenaa]
5 [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Sonnabend]
1 [Domingo, Luns, Terza_feira, Corta_feira, Xoves, Venres, Sábado]
7 [Dies_Solis, Dies_Lunae, Dies_Martis, Dies_Mercurii, Dies_Iovis, Dies_Veneris, Dies_Sabbatum]
12 [xing-_qi-_tiàn, xing-_qi-_yi-., xing-_qi-_èr, xing-_qi-_san-., xing-_qi-_sì, xing-_qi-_wuv., xing-_qi-_liù]
4 [djadomingu, djaluna, djamars, djarason, djaweps, djabièrnè, djasabra]
2 [Killachau, Atichau, Quoyllurchau, Illapachau, Chaskachau, Kuychichau, Intichau]

TSE SAL

STRING PROC FNStringGetExpressionRegularCharacterMetaEscapeS( STRING inS )
 STRING s[255] = inS
 s = StrReplace( "\", s, "\\", "gn" )
 s = StrReplace( "{", s, "\{", "gn" )
 s = StrReplace( "[", s, "\[", "gn" )
 s = StrReplace( "}", s, "\}", "gn" )
 s = StrReplace( "]", s, "\]", "gn" )
 s = StrReplace( "*", s, "\*", "gn" )
 s = StrReplace( "+", s, "\+", "gn" )
 s = StrReplace( "@", s, "\@", "gn" )
 s = StrReplace( ".", s, "\.", "gn" )
 s = StrReplace( "^", s, "\^", "gn" )
 s = StrReplace( "$", s, "\$", "gn" )
 s = StrReplace( "|", s, "\|", "gn" )
 s = StrReplace( "?", s, "\?", "gn" )
 s = StrReplace( "#", s, "\#", "gn" )
 RETURN( s )
END
//
INTEGER PROC FNBlockGetAbbreviationLengthMinimumToBufferB( INTEGER buffer1I )
 INTEGER B = FALSE
 INTEGER downB = TRUE
 STRING s[255] = ""
 INTEGER foundB = FALSE
 INTEGER minI = 1
 INTEGER I = 0
 INTEGER buffer2I = 0
 STRING s1[255] = ""
 INTEGER lineColumnStartI = 4 // change this
 Set( BREAK, ON )
 PushPosition()
 PushBlock()
 GotoBlockBegin()
 WHILE ( ( IsCursorInBlock() ) AND ( downB ) )
  IF NOT LFind( "^$", "cgx" )
   I = minI - 1
   REPEAT
    I = I + 1
    PushPosition()
    buffer2I = CreateTempBuffer()
    PopPosition()
    BegLine()
    REPEAT
     IF ( LFind( "{.*}{{[ ]#}|$}\c", "cx" ) )
      s = GetFoundText( 1 )
      s = Trim( s )
      s1 = LeftStr( s, I )
      PushPosition()
      PushBlock()
      GotoBufferId( buffer2I )
      foundB = LFind( Format( "^", FNStringGetExpressionRegularCharacterMetaEscapeS( s1 ), "$" ), "gx" )
      IF NOT foundB
       EndFile()
       AddLine( s1 )
      ENDIF
      PopBlock()
      PopPosition()
     ENDIF
    UNTIL ( ( ( CurrChar() == _AT_EOL_ ) OR ( CurrChar() == _BEYOND_EOL_ ) ) OR ( foundB ) )
    AbandonFile( buffer2I )
   UNTIL ( NOT ( foundB ) )
  ENDIF
  IF NOT foundB
   PushPosition()
   PushBlock()
   BegLine()
   UnMarkBlock()
   MarkStream()
   EndLine()
   Left()
   MarkStream()
   Copy()
   GotoBufferId( buffer1I )
   EndFile()
   AddLine( Str( I ) )
   GotoColumn( lineColumnStartI )
   Paste()
   PopBlock()
   PopPosition()
  ENDIF
  downB = Down()
 ENDWHILE
 B = TRUE
 PopPosition()
 PopBlock()
 RETURN( B )
END
//
PROC Main()
 INTEGER bufferI = 0
 PushPosition()
 bufferI = CreateTempBuffer()
 PopPosition()
 Message( FNBlockGetAbbreviationLengthMinimumToBufferB( bufferI ) )
 GotoBufferId( bufferI )
END
Output:

2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag 4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë 2 Ehud Segno Maksegno Erob Hamus Arbe Kedame 5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit 4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat 2 domingu llunes martes miércoles xueves vienres sábadu 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn 6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat 4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar 2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota 5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn 2 nedelia ponedelnik vtornik sriada chetvartak petak sabota 12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk 4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte 16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee 6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn 2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi 2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota 2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota 2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee 2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag 2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato 1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev 7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata 2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur 2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh 2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai 2 dimanche lundi mardi mercredi jeudi vendredi samedi 4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon 2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado 2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati 2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag 2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato 3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar 6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono 7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat 3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar 3 vasárnap hétfö kedd szerda csütörtök péntek szombat 2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur 2 sundio lundio mardio merkurdio jovdio venerdio saturdio 3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu 2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato 4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn 2 domenica lunedí martedí mercoledí giovedí venerdí sabato 2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi 1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni 3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien 2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis 3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi 12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù 3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam 3 Jabot Manre Juje Wonje Taije Balaire Jarere 5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro 2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu 2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag 7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte 4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra 2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota 3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado 1 Domingo Lunes martes Miercoles Jueves Viernes Sabado 2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª 2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota 4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne 2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota 5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo 2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha- 2 nedel^a pondelok utorok streda s^tvrtok piatok sobota 2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota 2 domingo lunes martes miércoles jueves viernes sábado 2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday 7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi 2 söndag måndag tisdag onsdag torsdag fredag lordag 2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado 6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák 7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao 5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso 6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi 2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota 8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y 6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn 3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw 7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo 2 zuntik montik dinstik mitvokh donershtik fraytik shabes 7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni 11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ 2 Sun Moon Mars Mercury Jove Venus Saturn 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag 2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa 5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend 1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado 7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum 12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù 4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra 2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Uiua

Works with: Uiua version 0.12.0-dev.1

Try it in Uiua Pad!

# Find shortest distinct abbreviation per line

Lines ← {"Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
         "sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk"
         ""
         "Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata"
         "sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur"
         "Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh"}
Split ← ⊜□⊸(≠@ )
Pref ← +1⬚¯1⊢⊚¬⬚@ ≡≍ # for two strings give pos of first diff char
≡◇(&p$"_: _" :/$"_ _"⟜(⧻⊢)≡◇⬚@ ↙/↥/↥⊞◇Pref..Split)▽⊸≡(>0◇⧻)Lines
Output:
2: Su Mo Tu We Th Fr Sa
12: sing_kei_yah sing_kei_yat sing_kei_yee sing_kei_saa sing_kei_sie sing_kei_ng  sing_kei_luk
7: Diu_pri Diu_seq Diu_tri Diu_qua Diu_qui Diu_sex Diu_sab
2: su má tÿ mi hó fr le
2: Ye Do Se Ch Pa Jo Sh

VBA

Function :

Function MinimalLenght(strLine As String) As Integer
Dim myVar As Variant, I As Integer, Flag As Boolean, myColl As Collection, Count As Integer
   myVar = Split(strLine, " ")
   Count = 0
   Do
      Set myColl = New Collection
      Count = Count + 1
      On Error Resume Next
      Do
         myColl.Add Left$(myVar(I), Count), Left$(myVar(I), Count)
         I = I + 1
      Loop While Err.Number = 0 And I <= UBound(myVar)
      Flag = Err.Number = 0
      On Error GoTo 0
      I = 0
      Set myColl = Nothing
   Loop While Not Flag
   MinimalLenght = Count
End Function

To call it :

Sub Main_Abbr_Auto()
Dim Nb As Integer, s As String, Result() As String, c As Integer
   Nb = FreeFile
   Open "C:\Users\" & Environ("Username") & "\Desktop\Abbreviations_Auto.txt" For Input As #Nb
      While Not EOF(Nb)
         Line Input #Nb, s
         If InStr(s, "þ") > 0 Then s = Right(s, Len(s) - 2)
         If s <> vbNullString Then
            ReDim Preserve Result(c)
            Result(c) = Left$(MinimalLenght(s) & "    ", 4) & s
            Debug.Print Result(c)
            c = c + 1
         End If
      Wend
   Close #Nb
End Sub
Output:
2   Sunday Monday Tuesday Wednesday Thursday Friday Saturday
2   Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
4   E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
2   Ehud Segno Maksegno Erob Hamus Arbe Kedame
5   Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
4   Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
2   domingu llunes martes miércoles xueves vienres sábadu
2   Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
6   Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
4   Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
2   Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
5   Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
2   nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
4   Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
6   dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
2   Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
2   nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
2   nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
2   Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
2   s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
2   zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2   Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
1   pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
7   Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
2   sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
2   Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
2   sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
2   dimanche lundi mardi mercredi jeudi vendredi samedi
4   Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
2   Domingo Segunda_feira Martes Mércores Joves Venres Sábado
2   k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
2   Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
2   Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
3   ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
6   pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
7   Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
3   ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
3   vasárnap hétfö kedd szerda csütörtök péntek szombat
2   Sunnudagur Mánudagur ^%ri´�judagur Mi´�vikudagar Fimmtudagur FÖstudagur Laugardagur
2   sundio lundio mardio merkurdio jovdio venerdio saturdio
3   Minggu Senin Selasa Rabu Kamis Jumat Sabtu
2   Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
4   Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
2   domenica lunedí martedí mercoledí giovedí venerdí sabato
2   Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
1   Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
7   Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
3   sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
2   Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
3   Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
3   Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
3   Jabot Manre Juje Wonje Taije Balaire Jarere
5   geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
2   Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
2   s�ndag mandag tirsdag onsdag torsdag fredag l�rdag
7   lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
4   djadomingo djaluna djamars djarason djaweps djabièrna djasabra
2   Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
3   Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
2   Domingo Lunes martes Miercoles Jueves Viernes Sabado
2   Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
2   voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
4   Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
2   nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
5   Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
2   Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
2   nedel^a pondelok utorok streda s^tvrtok piatok sobota
2   Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
2   domingo lunes martes miércoles jueves viernes sábado
2   sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
7   Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
2   söndag måndag tisdag onsdag torsdag fredag lordag
2   Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
6   Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
7   wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
5   Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
6   Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
2   nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
8   Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
6   dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
3   Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
7   iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
2   zuntik montik dinstik mitvokh donershtik fraytik shabes
7   iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
7   Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
2   Sun Moon Mars Mercury Jove Venus Saturn
2   zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
2   KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
5   Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
1   Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
7   Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
4   djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
2   Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

VBScript

sub print(s) wscript.stdout.writeline s   :end sub

set d=createobject("Scripting.Dictionary")
set fso=createobject("Scripting.Filesystemobject")

const fn="weekdays_ansi.txt"
sfn=WScript.ScriptFullName
sfn= Left(sfn, InStrRev(sfn, "\"))
set f=fso.opentextfile(sfn & fn,1)

while not f.atendofstream
  s=f.readline
  if s=vbNullString then 
	   print " " 
	else
    a=split(trim(s)," ")
    for abrlen=1 to 14
      d.removeall
      for wd=0 to 6
        k=left(a(wd),abrlen)
        if d.exists(k) then 
          exit for  
        else
          d.add k,""
        end if      
      next  'wd
      if wd>6 then exit for
    next 'abrlen
	  b=right("  " & abrlen,2)
	  for wd=0 to 6 
       b=b &" "& left(a(wd),abrlen)
    next
    print b
  end if	
wend  'line
f.close
Output:
 2 Su Mo Tu We Th Fr Sa
 2 So Ma Di Wo Do Vr Sa
 4 E_dj E_hë E_ma E_më E_en E_pr E_sh
 2 Eh Se Ma Er Ha Ar Ke
 5 Al_Ah Al_It Al_Th Al_Ar Al_Ka Al_Go Al_Sa
 4 Guir Yerg Yere Tcho Hink Ourp Shap
 2 do ll ma mi xu vi sá
 2 Ba Bi Çk Üç DÖ Be Al
 6 Igande Astele Astear Asteaz Ostegu Ostira Larunb
 4 Robi Shom Mong Budh BRih Shuk Shon
 2 Ne Po Ut Sr Cx Pe Su
 5 Disul Dilun Dimeu Dimer Diria Digwe Disad
 2 ne po vt sr ch pe sa
12 sing_kei_yah sing_kei_yat sing_kei_yee sing_kei_saa sing_kei_sie sing_kei_ng sing_kei_luk
 4 Dium Dill Dima Dime Dijo Dive Diss
15 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh Tah_neesee_dzee Deehn_ghee_dzee Tl-oowey_tts-el Dzeentt-ahzee
 6 dy_Sul dy_Lun dy_Meu dy_Mer dy_You dy_Gwe dy_Sad
 2 Di Le Ma Mè Je Va Sa
 2 ne po ut sr cx pe su
 2 ne po út st c^ pá so
 2 So Mo Ti Wa TO Fe Sa
 2 s0 ma ti on to fr l0
 2 zo ma di wo do vr za
 2 Di Lu Ma Me ^J Ve Sa
 1 p e t k n r l

Visual Basic .NET

Translation of: C#
Module Module1

    Sub Main()
        Dim lines = IO.File.ReadAllLines("days_of_week.txt")
        Dim i = 0

        For Each line In lines
            i += 1
            If line.Length > 0 Then
                Dim days = line.Split()
                If days.Length <> 7 Then
                    Throw New Exception("There aren't 7 days in line " + i)
                End If

                Dim temp As New Dictionary(Of String, Integer)
                For Each d In days
                    If temp.ContainsKey(d) Then
                        Console.WriteLine(" ∞  {0}", line)
                        Continue For
                    End If
                    temp.Add(d, 1)
                Next

                Dim len = 1
                Do
                    temp.Clear()
                    For Each d In days
                        Dim key As String
                        If len < d.Length Then
                            key = d.Substring(0, len)
                        Else
                            key = d
                        End If
                        If temp.ContainsKey(key) Then
                            Exit For
                        End If
                        temp.Add(key, 1)
                    Next
                    If temp.Count = 7 Then
                        Console.WriteLine("{0,2:D}  {1}", len, line)
                        Exit Do
                    End If
                    len += 1
                Loop
            End If
        Next
    End Sub

End Module
Output:
 2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2  domingu llunes martes miércoles xueves vienres sábadu
 2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
12  sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
 7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2  dimanche lundi mardi mercredi jeudi vendredi samedi
 4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3  vasárnap hétfö kedd szerda csütörtök péntek szombat
 2  Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2  sundio lundio mardio merkurdio jovdio venerdio saturdio
 3  Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2  Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4  Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2  domenica lunedí martedí mercoledí giovedí venerdí sabato
 2  Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1  Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3  sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2  Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3  Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12  xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3  Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3  Jabot Manre Juje Wonje Taije Balaire Jarere
 5  geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2  Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2  sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7  lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4  djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2  Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3  Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1  Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2  Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2  voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4  Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2  nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5  Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2  Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2  nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2  Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2  domingo lunes martes miércoles jueves viernes sábado
 2  sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7  Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2  söndag måndag tisdag onsdag torsdag fredag lordag
 2  Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6  Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7  wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5  Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6  Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2  nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8  Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6  dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3  Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7  iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2  zuntik montik dinstik mitvokh donershtik fraytik shabes
 7  iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7  Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11  Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2  Sun Moon Mars Mercury Jove Venus Saturn
 2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2  KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1  Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7  Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12  xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4  djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2  Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

V (Vlang)

Translation of: Go
import os
 
fn distinct_strings(strs []string) []string {
    len := strs.len
    mut set := map[string]bool{}
    mut distinct := []string{cap: len}
    for str in strs {
        if str !in set {
            distinct << str
            set[str] = true
        }
    }
    return distinct
}
 
fn take_runes(s string, n int) string {
    mut i := 0
    for j in 0..s.len {
        if i == n {
            return s[..j]
        }
        i++
    }
    return s
}
 
fn main() {
    lines := os.read_lines('days_of_week.txt')?
    mut line_count := 0
    for l in lines {
        mut line := l

        line = line.trim(' ')
        line_count++
        if line == "" {
            println('')
            continue
        }
        days := line.split(' ')
        if days.len != 7 {
            println("There aren't 7 days in line $line_count")
            return
        }
        if distinct_strings(days).len != 7 { // implies some days have the same name
            println(" ∞ $line")
            continue
        }
        for abbrev_len := 1; ; abbrev_len++ {
            mut abbrevs := []string{len: days.len}
            for i := 0; i < days.len; i++ {
                abbrevs[i] = take_runes(days[i], abbrev_len)
            }
            if distinct_strings(abbrevs).len == 7 {
                println("${abbrev_len:2}  $line")
                break
            }
        }
    }
}
Output:
Same as Go entry.

Wren

Translation of: Kotlin
Library: Wren-pattern
Library: Wren-seq
Library: Wren-fmt
import "io" for File
import "./pattern" for Pattern
import "./seq" for Lst
import "./fmt" for Fmt

var p = Pattern.new("+1/s")
var lines = File.read("days_of_week.txt").split("\n").map { |l| l.trim() }
var i = 1
for (line in lines) {
    if (line == "") {
        if (i != lines.count) System.print()
    } else {
        var days = p.splitAll(line)
        if (days.count != 7) Fiber.abort("There aren't seven days in line %(i).")
        if (Lst.distinct(days).count < 7) { // implies some days have the same name
            System.print(" ∞  %(line)")
        } else {
            var len = 1
            while (true) {
                if (Lst.distinct(days.map { |d| d.take(len).join() }.toList).count == 7) {
                    Fmt.print("$2d $s", len, line)
                    break
                }
                len = len + 1
            }
        }
    }
    i = i + 1
}
Output:
 2 Sunday Monday Tuesday Wednesday Thursday Friday Saturday
 2 Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
 4 E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
 2 Ehud Segno Maksegno Erob Hamus Arbe Kedame
 5 Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
 4 Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
 2 domingu llunes martes miércoles xueves vienres sábadu
 2 Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
 6 Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
 4 Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
 2 Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
 5 Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
 2 nedelia ponedelnik vtornik sriada chetvartak petak sabota
12 sing_kei_yaht sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
 4 Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
16 Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
 6 dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
 2 Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
 2 nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
 2 nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
 2 Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
 2 s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
 1 pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev

 7 Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
 2 sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
 2 Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
 2 sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
 2 dimanche lundi mardi mercredi jeudi vendredi samedi
 4 Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
 2 Domingo Segunda_feira Martes Mércores Joves Venres Sábado
 2 k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
 2 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
 2 Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
 3 ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
 6 pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
 7 Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
 3 ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
 3 vasárnap hétfö kedd szerda csütörtök péntek szombat
 2 Sunnudagur Mánudagur ╞riδjudagur Miδvikudagar Fimmtudagur FÖstudagur Laugardagur
 2 sundio lundio mardio merkurdio jovdio venerdio saturdio
 3 Minggu Senin Selasa Rabu Kamis Jumat Sabtu
 2 Dominica Lunedi Martedi Mercuridi Jovedi Venerdi Sabbato
 4 Dé_Domhnaigh Dé_Luain Dé_Máirt Dé_Ceadaoin Dé_ardaoin Dé_hAoine Dé_Sathairn
 2 domenica lunedí martedí mercoledí giovedí venerdí sabato
 2 Nichiyou_bi Getzuyou_bi Kayou_bi Suiyou_bi Mokuyou_bi Kin'you_bi Doyou_bi
 1 Il-yo-il Wol-yo-il Hwa-yo-il Su-yo-il Mok-yo-il Kum-yo-il To-yo-il
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
 3 sve-tdien pirmdien otrdien tresvdien ceturtdien piektdien sestdien
 2 Sekmadienis Pirmadienis Antradienis Trec^iadienis Ketvirtadienis Penktadienis S^es^tadienis
 3 Wangu Kazooba Walumbe Mukasa Kiwanuka Nnagawonye Wamunyi
12 xing-_qi-_rì xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 3 Jedoonee Jelune Jemayrt Jecrean Jardaim Jeheiney Jesam
 3 Jabot Manre Juje Wonje Taije Balaire Jarere
 5 geminrongo minòmishi mártes mièrkoles misheushi bèrnashi mishábaro
 2 Ahad Isnin Selasa Rabu Khamis Jumaat Sabtu
 2 sφndag mandag tirsdag onsdag torsdag fredag lφrdag
 7 lo_dimenge lo_diluns lo_dimarç lo_dimèrcres lo_dijòus lo_divendres lo_dissabte
 4 djadomingo djaluna djamars djarason djaweps djabièrna djasabra
 2 Niedziela Poniedzial/ek Wtorek S,roda Czwartek Pia,tek Sobota
 3 Domingo segunda-feire terça-feire quarta-feire quinta-feire sexta-feira såbado
 1 Domingo Lunes martes Miercoles Jueves Viernes Sabado
 2 Duminicª Luni Mart'i Miercuri Joi Vineri Sâmbªtª
 2 voskresenie ponedelnik vtornik sreda chetverg pyatnitsa subbota
 4 Sunday Di-luain Di-màirt Di-ciadain Di-ardaoin Di-haoine Di-sathurne
 2 nedjelja ponedjeljak utorak sreda cxetvrtak petak subota
 5 Sontaha Mmantaha Labobedi Laboraro Labone Labohlano Moqebelo
 2 Iridha- Sandhudha- Anga.haruwa-dha- Badha-dha- Brahaspa.thindha- Sikura-dha- Sena.sura-dha-
 2 nedel^a pondelok utorok streda s^tvrtok piatok sobota
 2 Nedelja Ponedeljek Torek Sreda Cxetrtek Petek Sobota
 2 domingo lunes martes miércoles jueves viernes sábado
 2 sonde mundey tude-wroko dride-wroko fode-wroko freyda Saturday
 7 Jumapili Jumatatu Jumanne Jumatano Alhamisi Ijumaa Jumamosi
 2 söndag måndag tisdag onsdag torsdag fredag lordag
 2 Linggo Lunes Martes Miyerkoles Huwebes Biyernes Sabado
 6 Lé-pài-jít Pài-it Pài-jï Pài-sañ Pài-sì Pài-gÖ. Pài-lák
 7 wan-ar-tit wan-tjan wan-ang-kaan wan-phoet wan-pha-ru-hat-sa-boh-die wan-sook wan-sao
 5 Tshipi Mosupologo Labobedi Laboraro Labone Labotlhano Matlhatso
 6 Pazar Pazartesi Sali Çar,samba Per,sembe Cuma Cumartesi
 2 nedilya ponedilok vivtorok sereda chetver pyatnytsya subota
 8 Chu?_Nhâ.t Thú*_Hai Thú*_Ba Thú*_Tu* Thú*_Na'm Thú*_Sáu Thú*_Ba?y
 6 dydd_Sul dyds_Llun dydd_Mawrth dyds_Mercher dydd_Iau dydd_Gwener dyds_Sadwrn
 3 Dibeer Altine Talaata Allarba Al_xebes Aljuma Gaaw
 7 iCawa uMvulo uLwesibini uLwesithathu uLuwesine uLwesihlanu uMgqibelo
 2 zuntik montik dinstik mitvokh donershtik fraytik shabes
 7 iSonto uMsombuluko uLwesibili uLwesithathu uLwesine uLwesihlanu uMgqibelo
 7 Dies_Dominica Dies_Lunæ Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Saturni
11 Bazar_gÜnÜ Bazar_ærtæsi Çærs,ænbæ_axs,amò Çærs,ænbæ_gÜnÜ CÜmæ_axs,amò CÜmæ_gÜnÜ CÜmæ_Senbæ
 2 Sun Moon Mars Mercury Jove Venus Saturn
 2 zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
 2 KoseEraa GyoOraa BenEraa Kuoraa YOwaaraa FeEraa Memenaa
 5 Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Sonnabend
 1 Domingo Luns Terza_feira Corta_feira Xoves Venres Sábado
 7 Dies_Solis Dies_Lunae Dies_Martis Dies_Mercurii Dies_Iovis Dies_Veneris Dies_Sabbatum
12 xing-_qi-_tiàn xing-_qi-_yi-. xing-_qi-_èr xing-_qi-_san-. xing-_qi-_sì xing-_qi-_wuv. xing-_qi-_liù
 4 djadomingu djaluna djamars djarason djaweps djabièrnè djasabra
 2 Killachau Atichau Quoyllurchau Illapachau Chaskachau Kuychichau Intichau

Yabasic

a = open("days_of_week.txt", "r")

while(not eof(#a))
    line input #a s$
    print buscar(s$), " ", s$
wend

close #a

sub buscar(s$)
    local n, d, i, j, s, a$, b$, r$(1)
    
    n = token(s$, r$())
    d = 1
    
    repeat
        s = true
        for i = 1 to n
            for j = i + 1 to n
                a$ = left$(r$(i), d)
                b$ = left$(r$(j), d)
                if a$ = "" or b$ = "" s = true : break 2
                if a$ = b$ s = false : d = d + 1 : break 2
            next
        next
    until(s)
    return d
end sub

zkl

zkl doesn't grok UTF-8 so I'm using a byte by byte check. It works surprisingly well.

nds:=File("daysOfWeek.txt").read().howza(11)	// stripped lines
.pump(List,Void.Filter,fcn(day){ 
   d,N,m := day.split(),d.len(),(0).max(d.apply("len"));  // N==7
   foreach n in ([1..m]){
      ds:=d.apply("get",0,n);  // ("Su","Mo","Tu","We","Th","Fr","Sa")
      foreach a,b in (N,[a+1..N-1]){ if(ds[a]==ds[b]) continue(3); } # Th==Fr?
      return(n,day);	// part way though the words and found unique
   }
   return(m,day); // no match nowhere
});
foreach n,s in (nds){ println("%3d  %s".fmt(n,s)); }
Output:
  2  Sunday Monday Tuesday Wednesday Thursday Friday Saturday
  2  Sondag Maandag Dinsdag Woensdag Donderdag Vrydag Saterdag
  4  E_djelë E_hënë E_martë E_mërkurë E_enjte E_premte E_shtunë
  2  Ehud Segno Maksegno Erob Hamus Arbe Kedame
  5  Al_Ahad Al_Ithinin Al_Tholatha'a Al_Arbia'a Al_Kamis Al_Gomia'a Al_Sabit
  4  Guiragui Yergou_shapti Yerek_shapti Tchorek_shapti Hink_shapti Ourpat Shapat
  2  domingu llunes martes miércoles xueves vienres sábadu
  2  Bazar_gÜnÜ Birinci_gÜn Çkinci_gÜn ÜçÜncÜ_gÜn DÖrdÜncÜ_gÜn Bes,inci_gÜn Altòncò_gÜn
  6  Igande Astelehen Astearte Asteazken Ostegun Ostiral Larunbat
  4  Robi_bar Shom_bar Mongal_bar Budhh_bar BRihashpati_bar Shukro_bar Shoni_bar
  2  Nedjelja Ponedeljak Utorak Srijeda Cxetvrtak Petak Subota
  5  Disul Dilun Dimeurzh Dimerc'her Diriaou Digwener Disadorn
  2  nedelia ponedelnik vtornik sriada chetvartak petak sabota
 13  sing_kei_yath sing_kei_yat sing_kei_yee sing_kei_saam sing_kei_sie sing_kei_ng sing_kei_luk
  4  Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte
 16  Dzeenkk-eh Dzeehn_kk-ehreh Dzeehn_kk-ehreh_nah_kay_dzeeneh Tah_neesee_dzeehn_neh Deehn_ghee_dzee-neh Tl-oowey_tts-el_dehlee Dzeentt-ahzee
  6  dy_Sul dy_Lun dy_Meurth dy_Mergher dy_You dy_Gwener dy_Sadorn
  2  Dimanch Lendi Madi Mèkredi Jedi Vandredi Samdi
  2  nedjelja ponedjeljak utorak srijeda cxetvrtak petak subota
  2  nede^le ponde^lí úterÿ str^eda c^tvrtek pátek sobota
  2  Sondee Mondee Tiisiday Walansedee TOOsedee Feraadee Satadee
  2  s0ndag mandag tirsdag onsdag torsdag fredag l0rdag
  2  zondag maandag dinsdag woensdag donderdag vrijdag zaterdag
  2  Diman^co Lundo Mardo Merkredo ^Jaùdo Vendredo Sabato
  1  pÜhapäev esmaspäev teisipäev kolmapäev neljapäev reede laupäev
  7  Diu_prima Diu_sequima Diu_tritima Diu_quartima Diu_quintima Diu_sextima Diu_sabbata
  2  sunnudagur mánadagur tÿsdaguy mikudagur hósdagur friggjadagur leygardagur
  2  Yek_Sham'beh Do_Sham'beh Seh_Sham'beh Cha'har_Sham'beh Panj_Sham'beh Jom'eh Sham'beh
  2  sunnuntai maanantai tiistai keskiviiko torsktai perjantai lauantai
  2  dimanche lundi mardi mercredi jeudi vendredi samedi
  4  Snein Moandei Tiisdei Woansdei Tonersdei Freed Sneon
  2  Domingo Segunda_feira Martes Mércores Joves Venres Sábado
  2  k'vira orshabati samshabati otkhshabati khutshabati p'arask'evi shabati
  2  Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag
  2  Kiriaki' Defte'ra Tri'ti Teta'rti Pe'mpti Paraskebi' Sa'bato
  3  ravivaar somvaar mangalvaar budhvaar guruvaar shukravaar shanivaar
  7  pópule pó`akahi pó`alua pó`akolu pó`ahá pó`alima pó`aono
  7  Yom_rishon Yom_sheni Yom_shlishi Yom_revi'i Yom_chamishi Yom_shishi Shabat
  3  ravivara somavar mangalavar budhavara brahaspativar shukravara shanivar
  3  vasárnap hétfö kedd szerda csütörtök péntek szombat