Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Abbreviations-automatic/Tcl/abbreviations-automatic.tcl
Normal file
18
Task/Abbreviations-automatic/Tcl/abbreviations-automatic.tcl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue