Jump to content

Determine if a string has all unique characters: Difference between revisions

No edit summary
Line 2,683:
=={{header|Ring}}==
<lang ring>
load "stdlib.ring"
 
inputStr = ["",".","abcABC","XYZ ZYX","1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ"]
 
for nStr =in 1 to len(inputStr)
checkfor x = 1 to len(Str)
for xy = x + 1 to len(inputStr[n]Str)
for y = x +if 1Str[x] to= len(inputStrStr[ny])
if inputStr[n][x] char = inputStrStr[n][yx]
check? "Input = 0" + "'" + Str + "'" + ", length = " + len(Str)
see? " First duplicate at positions " + x + " and " + y + ", character = " + "'" + char + "'" + nl
charloop = inputStr[n][x]3
see "Input = " + "'" + inputStr[n] + "'" + ", length = " + len(inputStr[n]) + nl
see " First duplicate at positions " + x + " and " + y + ", character = " + "'" + char + "'" + nl
exit 2
ok
next
next
see? "Input = " + "'" + inputStr[n]Str + "'" + ", length = " + len(inputStr[n]Str) + nl
if check = 1
see? " All characters are unique." + nl
see "Input = " + "'" + inputStr[n] + "'" + ", length = " + len(inputStr[n]) + nl
see " All characters are unique." + nl
ok
next
</lang>
2,468

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.