Skip to main content
added 27 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

><>, 1916 bytes

i:0(?;\
g?!o2p\;:::21g?!o1p
> doesn't have strings, so we make use of the codebox. TheDue to the toroidal nature of >, the following runs in a loop:
i         Read a char
:0(?;     Halt if EOF
:::       Push three copies of the char
2g1g        Get the value at (char, 21), which is 0 by default
?!o       Print the char if the value was nonzero
2p1p        Set the value at (char, 21) to char

Note that this uses the fact that the input only contains printable ASCII, as this would not work if ASCII 0 was present.

><>, 19 bytes

i:0(?;\
g?!o2p\:::2
> doesn't have strings, so we make use of the codebox. The following runs in a loop:
i         Read a char
:0(?;     Halt if EOF
:::       Push three copies of the char
2g        Get the value at (char, 2), which is 0 by default
?!o       Print the char if the value was nonzero
2p        Set the value at (char, 2) to char

Note that this uses the fact that the input only contains printable ASCII, as this would not work if ASCII 0 was present.

><>, 16 bytes

i:0(?;:::1g?!o1p
> doesn't have strings, so we make use of the codebox. Due to the toroidal nature of >, the following runs in a loop:
i         Read a char
:0(?;     Halt if EOF
:::       Push three copies of the char
1g        Get the value at (char, 1), which is 0 by default
?!o       Print the char if the value was nonzero
1p        Set the value at (char, 1) to char

Note that this uses the fact that the input only contains printable ASCII, as this would not work if ASCII 0 was present.

Post Undeleted by Sp3000
deleted 824 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

><>, 4919 bytes

i:1+?v;  >~70g:@@0(?!o
0pl0$\7;\
={+@}>:g?!^1-@}o2p\:70g-0::2
> doesn't have strings, only a strange mix of int/char/float, so we have to do a lotmake use of stack shifting. We leave all characters read so far on the stack, and check the current char against every one of themcodebox. The following runs in a loop:
[outer loop]

i           Read a char
:1+0(?v; ;     IfHalt it'sif EOF, halt. Otherwise, go down
70p         Store the char at (7, 0)
l    :::       Push thethree lengthcopies of the stack (number of chars to check through). Call this L.char
0  2g        Get Pushthe avalue 0at (willchar, end2), upwhich asis 0 if unique else positive). Call this U.

[innerby loop]
default
:?!^        If L is zero, exit the loop and go up.
1-        o  Decrement L
@}:70g-0=   Check ifPrint the char equalsif the top char onvalue thewas stacknonzero
{+@}        If so, add 1 to U,2p else add 0. Rotate the top char toSet the bottom.

[outer loop continued]

~           Pop L
70g:        Pushvalue theat (char and a copy
@@?!o       If U is zero, print2) theto char

Note that this uses the last part meansfact that sometimes we leave two copies of a char on the stack if U is positive, but that's perfectly okay since we'reinput only concerned about the set of chars read so farcontains printable ASCII, as this would not work if ASCII 0 was present.

><>, 49 bytes

i:1+?v;  >~70g:@@?!o
0pl0$\7
={+@}>:?!^1-@}:70g-0
> doesn't have strings, only a strange mix of int/char/float, so we have to do a lot of stack shifting. We leave all characters read so far on the stack, and check the current char against every one of them.
[outer loop]

i           Read a char
:1+?v;      If it's EOF, halt. Otherwise, go down
70p         Store the char at (7, 0)
l           Push the length of the stack (number of chars to check through). Call this L.
0           Push a 0 (will end up as 0 if unique else positive). Call this U.

[inner loop]

:?!^        If L is zero, exit the loop and go up.
1-          Decrement L
@}:70g-0=   Check if the char equals the top char on the stack
{+@}        If so, add 1 to U, else add 0. Rotate the top char to the bottom.

[outer loop continued]

~           Pop L
70g:        Push the char and a copy
@@?!o       If U is zero, print the char

Note that the last part means that sometimes we leave two copies of a char on the stack if U is positive, but that's perfectly okay since we're only concerned about the set of chars read so far.

><>, 19 bytes

i:0(?;\
g?!o2p\:::2
> doesn't have strings, so we make use of the codebox. The following runs in a loop:
i         Read a char
:0(?;     Halt if EOF
:::       Push three copies of the char
2g        Get the value at (char, 2), which is 0 by default
?!o       Print the char if the value was nonzero
2p        Set the value at (char, 2) to char

Note that this uses the fact that the input only contains printable ASCII, as this would not work if ASCII 0 was present.

Post Deleted by Sp3000
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

><>, 49 bytes

i:1+?v;  >~70g:@@?!o
0pl0$\7
={+@}>:?!^1-@}:70g-0
> doesn't have strings, only a strange mix of int/char/float, so we have to do a lot of stack shifting. We leave all characters read so far on the stack, and check the current char against every one of them.
[outer loop]

i           Read a char
:1+?v;      If it's EOF, halt. Otherwise, go down
70p         Store the char at (7, 0)
l           Push the length of the stack (number of chars to check through). Call this L.
0           Push a 0 (will end up as 0 if unique else positive). Call this U.

[inner loop]

:?!^        If L is zero, exit the loop and go up.
1-          Decrement L
@}:70g-0=   Check if the char equals the top char on the stack
{+@}        If so, add 1 to U, else add 0. Rotate the top char to the bottom.

[outer loop continued]

~           Pop L
70g:        Push the char and a copy
@@?!o       If U is zero, print the char

Note that the last part means that sometimes we leave two copies of a char on the stack if U is positive, but that's perfectly okay since we're only concerned about the set of chars read so far.