Nov 18th, 2016
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. S = {New Sequence init}
  2. for E in Xs do
  3.     {S insertFirst(E)}
  4. end
  6. fun {Check}
  7.     local A B C in
  8.         {S isEmpty(A)}
  9.         if A then true
  10.         else
  11.             {S first(B)}
  12.             {S last(C)}
  13.             if B == C then
  14.                 {S removeFirst}
  15.                 {S removeLast}
  16.                 {Check}
  17.             else
  18.             false
  19.             end
  20.         end
  21.     end
  22. end
  23. in
  24.     {Check}
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.