完全なペアリングの検出


25

関数fを持ちましょうf文字列を受け取り、隣接する同一の文字のすべてのペアを削除をします。例えば

f(abbbacc)=aba

2つのペアが重複する場合、そのうちの1つのみを削除することに注意してください。

繰り返しアプリケーションが最終的に空の文字列を生成する場合、文字列を完全にペアで呼び出します。たとえば、上の文字列は完全にペアではありません再度適用するとが得られるためです。ただし、ような文字列は完全にペアになっています 3回適用すると空の文字列が取得されるためです。f a b a e a b b c c a d d e fabbbaccfabaeabbccaddef

f(eabbccadde)=eaae

f(eaae)=ee

f(ee)=


あなたの仕事は、(印刷可能なASCIIの)文字列を受け取り、それが完全にペアリングされているかどうかを判断する、完全にペアリングされたコンピューターコードを記述することです。 ソースのバイト文字列それ自体が完全にペアの文字列である必要がありますが、コードは必ずしも印刷可能なASCIIに制限する必要はありません。

2つの異なる値を出力できます。1つは入力が完全にペアリングされている場合、もう1つはペアリングされていない場合です。

これは質問であるため、回答はソースのバイト数でスコア付けされ、バイト数は少ない方が良いでしょう。


テストケース

abbbaccFalseabcbaFalseababFalseabbbaabaccTrueeabbccaddeTruebbbbTrue


1
今すぐ変更するには遅すぎるかもしれませんが、コメントや同様の「デッド」コードを許可すると、チャレンジの「ねじれ」部分はほとんど無意味になります。
ジオビット

11
@Geobits私は同意しません。デッドコードを拒否することは漠然とした定義の単なる泥沼であり、とにかく決して面白くないと思う人がいます。2人の場合、コメントを許可することでエントリーの水準が下がると思います。3人にとって、コメントのないコードは、コメントのないコードよりも必然的に得点が高くなると考えています。ひねりは面白くないかもしれませんが、特定の方法で答えを出すために強化できない制限を追加すると、間違いなく面白くないでしょう。
小麦ウィザード

4
単項は、ソース制限ルールmwahahahahaについて気にしません(つまり、答えのバイト数が偶数である限り)。
アーナウルド

2
@Geobitsより創造的な答えを促したかもしれないことの1つは、スコアリングに空の文字列を取得するためのステップ数を考慮することです。コメントを使用すると、このスコアが非常に高くなる傾向があります。これは、スコアが低いとペアをかなりインターレースする必要があるため、コメントが自然にネストするためです。しかし、明らかにその変更を行うには遅すぎます。
小麦ウィザード

1
@dylnan空の文字列は可能ですが、永久にループすることは有効な出力ではありません。
小麦ウィザード

回答:


10

Haskell、146 124バイト

((""##))
a===bb=bb==a
((aa:bb))##((cc:dd))|aa===cc=bb##dd|1==1=((cc:aa:bb))##dd
a##""=""===a
""##cc=((cc!!00:cc!!00:""))##cc

コメントはありません。Trueまたはを返しますFalse

オンラインでお試しください!

編集:@Catウィザードのおかげで-22バイト


2
これは私が今まで見たハスケルのような最小のハスケルです
キュービック


5

05AB1E26 24 22 20 18バイト

ovsのおかげで-2バイト。文字列が完全にペアになっている場合は0、それ以外の場合は1を出力します。

ΔγʒgÉ}JJ}ĀqqĀÉgʒγΔ

オンラインでお試しください!

ΔγʒgÉ} JJ}ĀqqĀÉgʒγΔ–完全なプログラム。
Δ} –結果が変わらなくなるまで:
 γʒ} –文字列を等しい文字のチャンクに分割し、以下でフィルタリングします。
   ジェ-長さは奇数ですか?
      JJ –フィルタリング後、パーツを結合し直しますが、これを行います
                     以前のバージョンと同様に、2回保存して2バイトを節約します。
         Ā–結果が空かどうかを確認します
          q –実行を終了(終了)します。残りのコードは無視されます。
           qĀÉgʒγΔ–一致しない部分をミラーリングして、ソースレイアウトを支援します。

以前のバージョン

これは純粋に未定義の動作に依存するため(「デッドコード」はありません)、完全にペア化された文字列には[['0']]を、完全に一致しない文字列には[['1']]を出力します:

ΔγεDgÉ£}JJ}ĀĀ£ÉgDεγΔ 

また、説明した22バイトバージョンは、上記のとおりですが、UBを悪用せず、適切値を生成します。

ΔγεDgÉ£}JJ}ĀqqĀ£ÉgDεγΔ – Full program.
Δ         }            – Until fixed point is reached (starting from the input value):
 γε    }                 – Group equal adjacent values, and for each chunk,
   DgÉ                     – Duplicate, get its length mod by 2.
      £                    – And get the first ^ characters of it. This yields the
                             first char of the chunk or "" respectively for odd-length
                             and even-length chunks respectively.
         JJ                – Join the result to a string, but do this twice to help
                             us with the source layout, saving 2 bytes.
            Ā           – Check if the result is an empty string.
             q          – Terminate the execution. Any other commands are ignored.
              qĀ£ÉgDεγΔ – Mirror the part of the program that isn't otherwise removed
                          anyways. This part forgoes }JJ} because that substring will
                          always be trimmed by the algorithm anyway.

5

Cubix、54バイト

U#;!u1@.Oi>??>i..??O.@1^^...u--u.u!ww;..#..U..;..;!^^!

文字列が完全にペアリングされている1場合などは何も出力しません。
ここで試してみてください

立方体

      U # ;
      ! u 1
      @ . O
i > ? ? > i . . ? ? O .
@ 1 ^ ^ . . . u - - u .
u ! w w ; . . # . . U .
      . ; .
      . ; !
      ^ ^ !

説明

ほとんどの文字は、コードを完全にペアにするために必要なフィラーです。それらを.(no-op)に置き換えると、

      U # ;
      ! u 1
      @ . O
i . ? . > i . . ? . . .
. . ^ . . . . u - . . .
. . . w ; . . . . . . .
      . ; .
      . ; !
      ^ ^ !

これは3つのステップに分けることができます。

  • 空の文字列(左i?)を確認します。
  • ループ、スタックにキャラクターを投げて、重複(下と右のすべて)をポップします。
  • スタックが空かどうかを確認します(上部のもの)。

4

V20、18のバイト

òóˆ±òø‚

::‚øò±ˆóò

オンラインでお試しください!

Hexdump:

00000000: f2f3 88b1 f2f8 820a 0a3a 3a82 f8f2 b188  .........::.....
00000010: f3f2                                     ..                   ....

真実の場合は0、偽の場合は1を出力します。間接的に2バイトを節約してくれたnmjcman101に感謝します。

ò        ò        " Recursively...
 ó                "   Remove...
  <0x88>          "     Any printable ASCII character
        ±         "     Followed by itself
          ø       " Count...
           <0x82> "   The number of non-empty strings

::<0x82>øò±<0x88>óò      " NOP to ensure that the code is paired

置き換え^$.0を返し、真偽を返し、他に偽を返しますか?しばらくこれをしなかった後、私はルールに少しぼやけています。
nmjcman101

入力が完全にペアリングされている場合とそうでない場合の2つの異なる値を出力することができるというルールを除いて、それはうまくいくと思います。。しかし、それは私にアイデアを与えてくれます...
DJMcMayhem

3

R142126バイト

より厳密なロジックと@Giuseppeがコメントしたコメントバイト

f=function(x,p="(.)\\1")"if"(grepl(p,x),f(sub(p,"",x)),!nchar(x))##x(rahcn!,x,,p(bus(f,)x,p(lperg("fi")"1\\).("=p,x(noitcnuf=f

オンラインでお試しください!

f=function(x,p="(.)\\1")"if"(nchar(x),"if"(grepl(p,x),f(sub(p,"",x)),0),1)##)1,)0,xp(bus(f,)x,p(lperg("fi",)x(rahcn("fi")"1).("=p,x(noitcnuf=f

元の:

オンラインでお試しください!

関数内のすべての文字を逆順にしたコメントが続く再帰検出機能。


現在、コードはエラーをスローしています。これは、142バイトの作業バージョンです。
ovs

ありがとうございました。切り貼りの事故だったに違いありません。
ngm

126バイト -コメントをさらに圧縮できる場合もあります
ジュゼッペ

コメントで「\\ simplify」を簡略化するか、複製する必要があるかどうか疑問に思っています。
JayCe

@JayCeはコメントに含める必要はないと思うでしょうが、これを試してみて、うまくいかないようです。理由はわかりません。
ngm



2

Brain-Flak228 200バイト

(()){{{}([]<<{{(({}<<>>)<<>>[({})]){{{{}(<<<<>>()>>)((<<>>))}}}{}{}<<>>{}<<>>}}{}<<>>>>[[]])}}{}(<<({{(())(<<()>>)}}<<>>)>>){{{{}{}}((){{}{}{}{}{}}(()())())[[]((){{}{}}())[]]((){{}{}}[[][]]()){{}{}}}}

オンラインでお試しください!

これは、概念実証のビットです。おそらくもっと短いかもしれません。ただし、コメントは使用しません。

出力は0,0入力が完全にペアリングされている場合に0,1入力がない場合。


2

sed 4.2.2、34バイト

:;:t;ss((..??\??))\1ss1;t;/..??/cc

オンラインでお試しください!

ペアの文字列は空の出力を与え、ペアのない文字列は出力を与えます ct:

些細な回文バージョンは32 :;ss(.)\1ss;t;/./cc/./;t;1\).(;:です。古い解決策は、:;ss((..??\??))\1ss1;t;;/./cc/./t:(現在のものが乱用されcなかったため変更されました、編集c::Dの後には1文字しかありません)

(これ;はステートメントの区切り記号です)

: declares an empty label

:t declares the label t

ss((..??\??))\1ss1 is a substitution, in sed you can change the delimiter to a substitution, and this is what I did by changing it to s, so what this does is substitute the first (as is denoted by the 1 at the end)

  • match of ((..??\??))\1

    • . any character
    • .?? followed by an optional optional character
    • \?? and an optional ?
    • followed by the same thing right beside it
  • with nothing

Now this substitution is paired with itself, so the ;s before and after it get cancelled out too

t and loop back to the label until there are no more successful substitutions

/..?/ if . (wildcard) followed by .? an optional character is matched

  • cc change the buffer to c

2

Brain-Flak, 112 110 108 bytes

(()){{}({<<(({}<<>>)<<>>[({})]){{((<<>>)<<>>)}}{}{##{

}<<>>>>{}<<>>}<<>>)}{}((){{<<>>[[]]}})##}{}])}{([)}(}

Try it online!

This is based on my answer from Are the brackets matched?.

Tried not to use comments, but got stuck trying to make the pop nilads ({}) pair up. The problem lies in the easiest way to pair up a pair of brackets is to surround it in another pair of the same kind. While this is easy for other nilads, the {...} monad creates loops. In order to exit the loop you have to push a 0, but once you've exited the loop, you then have to pop the 0, which compounds the problem.

The 66 byte pre-paired solution is:

(()){{}({<(({}<>)<>[({})]){((<>)<>)}{}{}<>>{}<>}<>)}{}((){<>[[]]})

Try it online!

Outputs 1 or 1,0 if the input is a perfect pairing, 0,0 if not.

No comment version, 156 bytes

(()){{{}({<<(({}<<>>)<<>>[({{}((<<[[]]>>)){}}{}(<<[]>>){{}{}}{})]){{((<<>>)<<>>)}}{{}{}{}}{}{}<<>>>>{}<<>>}<<>>)}}{{}{}}{}((){<<>>[[]]})(<<()()>>){{}{}{}}{}

Try it online!

As Cat Wizard pointed out, the first answer does not work for all interpreters, as not all handle # comments. This version contains no comments.


Note that this only works in the ruby brainflak interpreter and thus is not a pure brainflak answer
Wheat Wizard

@CatWizard Is there a canon Brain-Flak interpreter? As far as I know, Rain-Flak (Ruby) is the original interpreter. (Also, I'm working on a solution without comments)
Jo King

Not really. Rain-Flak is the original interpreter but it's comments syntax is unique to it. We wrote a Brain-Flak standard a while back, I don't remember where it ended up though.
Wheat Wizard

@CatWizard Finished the no comment version
Jo King

2

Japt, 24 22 bytes

Outputs false for truthy and true for falsey.

&&!!e"(.)%1"PP"1%).("e

Try it


Would «e"(.)%1 work?
Oliver

@Oliver, that's what I originally had before the source restrictions were brought to my attention. Still trying to figure out a way to get it working with «, though.
Shaggy

@Oliver, it doesn't work, sadly.
Shaggy

I suspect you may have missed the restricted-source/source-layout part of the challenge, @Oliver.
Shaggy

I did...my bad.
Oliver

2

Brain-Flak, 96 bytes

{<<>>(({})<<>>[(([{}<<>>]))]){((<<[[]]>>))}{}{}{}{}<<>>}<<>>{{{}{}{}{}{}}((<<>>){{}{}}){{{}}}}{}

Try it online!

Outputs nothing if the input is perfectly paired, and 0 otherwise.

Non-perfectly paired (original) version:

{<>(({})<>[({}<>)]){((<()>))}{}{}{}<>}<>{((<>))}{}

Try it online!



2

Add++, 146 bytes

D,g,@~~,L2_|*;;*|_2L,@,g,D
D,ff,@^^,BG€gBF;;FBg€GB,@D1:?:

xx:?

aa:1
`bb
Bxx;;B
Waa*bb,`yy,$ff>xx,`aa,xx|yy,`bb,Byy,xx:yy

O;;O:,B,`,|,`,>$,`,*W`

Try it online!

Fun fact: This was 272 bytes long before the explanation was started, now it beats Java.

Outputs True for perfectly balanced strings, and False otherwise

To my great satisfaction, this beats the boring palindromize version by 2 bytes, to prevent the result being printed twice. I have also aimed to have as little dead code as possible, nevertheless there are still some commented-out sections, and the code exits with an error code of 1, after printing the correct value.

NB : A bug with the BF commands was fixed while this answer was in development.

How it works

The code starts by defining the two key functions, ff and g. These two functions are used to calculate the next step in the process of removing pairs, and work entirely from ff i.e. only ff is called from the main program, never g. If we define the input string as S, ff(S) modifies S in the following way:

First, identical adjacent characters in S are grouped together. For an example of abbbaabacc, this yields the array [[a],[bbb],[aa],[b],[a],[cc]]. Over each of the sublists (i.e. the identical groups), we run the function g, and replace the sublists with the result of the function.

g starts by unpacking the group, splatting the characters onto the stack. It then pushes the number of characters on the stack and takes the absolute difference with 2 and that number. We'll call this difference x. Lets see how this transforms the respective inputs of [a], [bb] and [ccc]:

[a][a,1]
[bb][b,b,0]
[ccc][c,c,c,1]

As you can see x indicates how many of the next character we wish to keep. For simple pairs, we remove them entirely (yielding 0 of the next character), for lone characters we leave them untouched, or yield 1 of them, and for groups where x>2, we want x2 of the character. In order to generate x of the character, we repeat the character with *, and the function naturally returns the top element of the stack: the repeated string.

After g(s) has been mapped over each group s, we splat the array to the stack to get each individual result with BF. Finally, the ^ flag at the function definition (D,ff,@^^,) tells the return function to concatenate the strings in the stack and return them as a single string. For pairs, which yielded the empty string from g, this essentially removes them, as the empty string concatenated with any string r results in r. Anything after the two ;; is a comment, and is thus ignored.

The first two lines define the two functions, ff and g, but don't execute ff just yet. We then take input and store it in the first of our 4 variables. Those variables are:

  • xx : The initial input and previous result of applying ff
  • yy : The current result of applying ff
  • aa : The loop condition
  • bb : Whether yy is truthy

As you can see, all variables and functions (aside from g) have two letter names, which allows them to be removed from the source code fairly quickly, rather than having a comment with a significant amount of xyab. g doesn't do this for one main reason:

If an operator, such as , is run over a user defined function abc, the function name needs to be enclosed in {...}, so that the entire name is taken by the operator. If however, the name is a single character, such as g, the {...} can be omitted. In this case, if the function name was gg, the code for ff and g would have to change to

D,gg,@~~,L2_|*;;*|_2L,@D             (NB: -2 bytes)
D,ff,@^^,BG€{gg}BF;;FB}gg{€GB,@D?:   (NB: +6 bytes)

which is 4 bytes longer.

An important term to introduce now is the active variable. All commands except assignment assign their new value to the active variable and if the active variable is being operated on, it can be omitted from function arguments. For example, if the active variable is x=5, then we can set x=15 by

x+10 ; Explicit argument
+10  ; Implicit argument, as x is active

The active variable is x by default, but that can be changed with the ` command. When changing the active variable, it is important to note that the new active variable doesn't have to exist beforehand, and is automatically assigned as 0.

So, after defining ff and g, we assign the input to xx with xx:?. We then need to manipulate our loop conditions ever so slightly. First, we want to make sure that we enter the while loop, unless xx is empty. Therefore, we assign a truthy value to aa with aa:1, the shortest such value being 1. We then assign the truthiness of xx to bb with the two lines

`bb
Bxx

Which first makes bb the active variable, then runs the boolean command on xx. The respective choices of aa:=1 and bb:=¬¬xx matter, as will be shown later on.

Then we enter our while loop:

Waa*bb,`yy,$ff>xx,`aa,xx|yy,`bb,Byy,xx:yy

A while loop is a construct in Add++: it operates directly on code, rather than variables. Constructs take a series of code statements, separated with , which they operate on. While and if statements also take a condition directly before the first , which consist of a single valid statement, such as an infix command with variables. One thing to note: the active variable cannot be omitted from the condition.

The while loop here consists of the condition aa*bb. This means to loop while both aa and bb are truthy. The body of the code first makes yy the active variable, in order to store the result of ff(x). This is done with

`yy,$ff>xx

We then activate our loop condition aa. We have two conditions for continued looping:

  • 1) The new value doesn't equal the old value (loop while unique)
  • 2) The new value isn't the empty string

One of Add++'s biggest drawbacks is the lack of compound statements, which necessitates having a second loop variable. We assign our two variables:

aa:=xxyy
bb:=¬¬(yy)

With the code

`aa,xx|yy,`bb,Byy

Where | is the inequality operator, and B converts to boolean. We then update the xx variable to be the yy variable with xx:yy, in preperation for the next loop.

This while loop eventually reduces the input into one of two states: the empty string or a constant string, even when applied to ff. When this happens, either aa or bb result in False, breaking out of the loop.

After the loop is broken, it can break for one of two reasons, as stated above. We then output the value of aa. If the loop was broken due to x=y, then both the output and aa are False. If the loop was broken because yy was equal to the empty string, then bb is falsy and aa and the output are truthy.

We then reach our final statement:

O

The program can now be in one of three states, in all of which the active variable is bb:

  • 1) The input was empty. In this case, the loop didn't run, aa=1 and bb=False. The correct output is False.
  • 2) The input was perfectly balanced. If so, the loop ran, aa=True and bb=False. The correct output is False
  • 3) The input was not perfectly balanced. If so, the loop ran, aa=False and bb=True. The correct output is True

As you can see, bb is equal to the expected output (albeit reversed from the logical answer), so we simply output it. The final bytes that help us beat Java come from the fact that bb is the active variable, so can be omitted from the argument, leaving us to output either True or False, depending on whether the input is perfectly balanced or not.


1

JavaScript (ES6), 76 bytes

Returns a boolean.

ff=ss=>ss==(ss=ss.replace(/(.)\1/,''))?!ss:ff(ss)//)(:!?,/1\).(/(ecalper.=(>

Try it online!

Suggested by @Shaggy: 58 bytes by returning an empty string for perfectly paired or throwing an error otherwise.


1
If one of the "return values" can be an error (waiting for confirmation on that) then this could be 66 bytes.
Shaggy

Programs can by default output via exit code. In this answer's particular case, the possible outputs would be exit code 0 for perfectly paired strings and exit code 1 for non-perfectly paired strings, which are two distinct values therefore fulfilling the criteria; so the 58 byter must be perfectly valid.
Mr. Xcoder


1

Lua, 178 bytes

p=...S={}for a in p:gmatch"."do E=S[#S]~=a;S[E and#S+1 or#S]=E and a or X end;print(#S==0)--)0S#(tnirp;dne X ro a dna E=]S#ro 1+S#dna E[S;a=~]S#[S=E od"."hctamg:p ni a rof}{=S.=p

Try it online!

While it is a terribly long solution, this does make quite a bit of use of Lua-specific quirks. This is actually a minified brute force stack algorithm. The program is made complicated by the fact that Lua's patterns don't allow replacing pairs and regex is not built in.

Explanation:

p=... -- command-line argument
S={} -- the stack
for c in p:gmatch"." do -- shorter than "for i=1,#p do ..."
    E=S[#S]~=c -- check whether we have the right letter on top of stack
    -- could've saved some bytes by doing == instead of ~=
    -- but the double negation is necessary for ternary operator
    -- to work with nil values
    S[E and #S+1 or #S]=E and c or X -- Lua's awesome "ternary operator"
end
-- i'm sure there is a better way to output this (table indexing?)
print(#S==0)

1

Gol><>, 30 bytes

1ll1**F:}}:{=Q{~~||lzBBzl{Q={F

Try it online!

Everything after the first B is excess code and is not executed. A function that returns the top of stack as 1 if the input is a perfect pairing, 0 otherwise.

Explanation:

1       Push 1 as the end string marker
 ll1**  Push n, where n (len+1)*(len+2), 
        This is larger than the amount of steps needed to determine pairing
      F           |  Repeat that many times
       :}}:{=        Compare the first two characters of the string
             Q   |   If they are equal
              {~~    Pop both of them
        String is also rotated by 1
        If the string becomes empty, the 1 is compared to itself and removed.
                   lzB   Return whether the length of the stack is 0
                      Bzl{Q={F  Excess code to match unpaired symbols

1

Cubix, 30 bytes

1O@;??;@ii??O;>>;;;..1Wcc1??1W

Try it online!

Outputs 1 if the string is perfectly paired and nothing otherwise.

Cubified

      1 O @
      ; ? ?
      ; @ i
i ? ? O ; > > ; ; ; . .
1 W c c 1 ? ? 1 W . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

Simplified

      1 O @
      ; ? .
      . @ .
i ? . . . . > ; ; ; . .
. W c . . . ? 1 W . . .
. . . . . . . . . . . .
      . . .
      . . .
      . . .

The logic and general structure are the same as in Mnemonic's answer, but without an explicit check for the empty string.



0

Python 2, 114 bytes

import re

e=lambda i,nn=1:e(*re.subn('(.)\\1','',i))if nn else''==i##ieslef'1).('(nbus.er*(e:1=,i adbmal=r tropmi

Try it online!

Returns True for perfectly-paired strings, False otherwise.

(Actually fails to verify itself, because (.) won't match the newlines in the code! But @Cat Wizard said this is okay, because newlines aren't printable ASCII characters, so my program needn't handle them.)


This is a perfectly-paired version of:

import re;p=lambda s,n=1:p(*re.subn('(.)\\1','',s))if n else''==i

for which a “lazier” perfectization of code + '##' + f(code[::-1]) would give 120 bytes. (That is, renaming the variables etc. to introduce more collapsed pairs inside the comment half of the code saved 6 bytes.)


re.subn is a little-known variant of re.sub that returns a tuple (new_string, number_of_substitutions_made). It's pretty good for finding regex substitution fixpoints!


0

Jelly, 26 24 22 bytes

ẠƬµF€ḂLḣgŒŒgḣLḂ$$€FµƬẠ

Try it online!

Weirdly seems to work without moving the backwards code to an unused link.

Returns 0 if the input is perfectly paired, 1 otherwise.

Active code:

ŒgḣLḂ$$€FµƬẠ
Œg            Group runs 'abbbcc'->['a','bbb','cc']
       €      For each of these strings:
      $       Monad{
     $            Monad{
   L                  Find the length...
    Ḃ                 ...mod 2. 
                      } -> [1, 1, 0] in this example.
  ḣ               Take this many characters from the string.
                  } -> [['a'], ['b'], []]
        F     Flatten -> ['a', 'b']
          Ƭ   Repeat...
         µ    The last monadic chain until a fixed point is reached.
           Ạ  All. If it is not a perfectly paired string, all elements in the 
              result of Ƭ will be nonempty and 1 is returned.
              If it is perfectly paired, the last element is [] which is falsy
              and 0 is returned.

0

Attache, 82 bytes

{0=#Fixpoint[{Replace[_,/"(.)\\1",""]},_]}??}]_,}],"1).("/,_[ecalpeR{[tniopxiF#=0{

Try it online!

Nothing incredible here. Fixpoints a function which removes consecutive pairs.


0

Java 8, 158 156 154 bytes

n->{for(;n.matches(".*(.)\\1.*");n=n.replaceAll("(.)\\1",""));return  n.isEmpty();}//};)(ytpmEsi.ruter;,"1).("(Aecalper.n=n;)"*.1).(*."(sehctam.n;(rof{>-n

Returns a boolean (true/false).

-2 bytes thanks to @raznagul.

Try it online.

Explanation:

n->{                              // Method with String parameter and boolean return-type
  for(;n.matches(".*(.)\\1.*");   //  Loop as long as the String still contains pairs
    n=n.replaceAll("(.)\\1","")); //   Remove all pairs
  return  n.isEmpty();}           //  Return whether the String is empty now
//};)(ytpmEsi.ruter;,"1).("(Aecalper.n=n;)"*.1).(*."(sehctam.n;(rof{>-n
                                  // Comment reversed of the source code,
                                  // minus the pairs: '\\';'ll';'\\';'""))';'n  n';'//'

1
By renaming s to n and adding a second space to return s.isEmpty you can remove s n from the comment, saving 2 bytes in total.
raznagul
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.