Anonymous user
Rep-string: Difference between revisions
→Tcl: Added two test patterns and output
(→version 2: changed REXX version 2 to handle two more strings. -- ~~~~) |
(→Tcl: Added two test patterns and output) |
||
Line 369:
=={{header|Tcl}}==
<lang tcl>proc repstring {text} {
set len [string length $text]
Line 384 ⟶ 383:
<lang tcl>foreach sample {
"1001110011" "1110111011" "0010010010" "1010101010" "1111111111"
"0100101101" "0100100" "101" "11" "00" "1"
} {
if {[catch {
Line 404 ⟶ 403:
"0100100" has repetition (length: 3) of "010"
"101" is not a repeated string
"11" has repetition (length: 1) of "1"
"00" has repetition (length: 1) of "0"
"1" is not a repeated string
</pre>
|