How to resolve the algorithm Determine if a string has all unique characters step by step in the Ring programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Determine if a string has all unique characters step by step in the Ring programming language

Table of Contents

Problem Statement

Given a character string   (which may be empty, or have a length of zero characters):

Use (at least) these five test values   (strings):

Show all output here on this page.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Determine if a string has all unique characters step by step in the Ring programming language

Source code in the ring programming language

inputStr = ["",".","abcABC","XYZ ZYX","1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ"]
 
for Str in inputStr
    for x = 1 to len(Str)
        for y = x + 1 to len(Str)
            if Str[x] = Str[y]
               char = Str[x]
               ? "Input = " + "'" + Str + "'" + ", length = " + len(Str)
               ? " First duplicate at positions " + x + " and " + y + ", character = " + "'" + char + "'"
               loop 3
            ok
        next
    next
    ? "Input = " + "'" + Str + "'" + ", length = " + len(Str)
    ? " All characters are unique."
next

  

You may also check:How to resolve the algorithm Fibonacci sequence step by step in the Befunge programming language
You may also check:How to resolve the algorithm Cullen and Woodall numbers step by step in the C++ programming language
You may also check:How to resolve the algorithm Knuth's power tree step by step in the Nim programming language
You may also check:How to resolve the algorithm Arrays step by step in the 8th programming language
You may also check:How to resolve the algorithm Sort an integer array step by step in the XPL0 programming language