How to resolve the algorithm Determine if a string has all unique characters step by step in the Quackery 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 Quackery 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 Quackery programming language

Source code in the quackery programming language

  [ over find swap found ]    is has         ( $ c --> b     )

  [ dip [ 0 0 true ]
    dup size 2 < iff
      drop done
    dup size 1 - times
      [ behead 2dup has iff
          [ swap find
            dip not
            2swap 2drop
            i^ tuck + 1+ rot
            0 conclude ] done
        drop ]
    drop ]                    is uniquechars (   $ --> n n b )

  [ dup say 'String "'
    echo$
    say '" has length '
    dup size echo
    say ". "
    dup uniquechars iff
      [ say "There are no duplicated characters."
        drop 2drop ]
    else
      [ rot over peek
        dup say 'The character "'
        emit
        say '" (hex:'
        16 base put
        echo
        base release
        say ") is at positions "
        swap echo
        say " and "
        echo
        say "." ]
    cr ]                       is task        (   $ -->       )

  $ "" task
  $ "." task
  $ "abcABC" task
  $ "XYZ ZYX" task
  $ "1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ" task

  

You may also check:How to resolve the algorithm Box the compass step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Tokenize a string step by step in the Jsish programming language
You may also check:How to resolve the algorithm List comprehensions step by step in the PARI/GP programming language
You may also check:How to resolve the algorithm Old Russian measure of length step by step in the Elena programming language
You may also check:How to resolve the algorithm Algebraic data types step by step in the Scala programming language