by enrico-sorichetti » Tue Jun 21, 2022 11:28 pm
the suggestion posted was for an academically correct full approach
since you only need to know if there are duplicates and not determine their value
a simple scan for repeated chars would be more than enough
here is a smal proof of concept written in rexx
the script
trace "O"
strings.1 = "ABCDEEFGGHIIEDH"
strings.2 = "TODAYISBESTDAYA"
strings.3 = "MAINFRAMEFILES"
strings.4 = "noduplicates"
strings.0 = 4
do s = 1 to strings.0
say "checking >"strings.s"<"
do i = 1 to length(strings.s) - 1
c = substr(strings.s,i,1 )
do j = i+1 to length(strings.s)
if substr(strings.s,j,1 ) = c then do
say " match found for >"strings.s"<" "at" i j ">"c"<"
iterate s
end
end
end
say " no duplicates in >"strings.s"<"
end
the result
~/z % rexx dups
checking >ABCDEEFGGHIIEDH<
match found for >ABCDEEFGGHIIEDH< at 4 14 >D<
checking >TODAYISBESTDAYA<
match found for >TODAYISBESTDAYA< at 1 11 >T<
checking >MAINFRAMEFILES<
match found for >MAINFRAMEFILES< at 1 8 >M<
checking >noduplicates<
no duplicates in >noduplicates<
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort