Advertisement
Guest User

Problem J

a guest
Mar 18th, 2012
217
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. USING: io kernel math math.parser strings sequences locals ;
  2.  
  3. IN: template
  4.  
  5. :: test ( rtn cur -- a b )
  6.  
  7. cur "" =
  8. [ rtn cur ]
  9. [
  10. cur 1 tail
  11. cur 1 head
  12.  
  13. "(" =
  14. [ "(" rtn append ]
  15. [
  16. rtn 1 head
  17. "(" =
  18. [ rtn 1 tail ]
  19. [ "X" rtn append ]
  20. if
  21. ]
  22. if
  23.  
  24. swap
  25. test
  26.  
  27. ]
  28. if ;
  29.  
  30.  
  31. "Z"
  32. readln
  33. test
  34.  
  35. drop
  36.  
  37. "Z" =
  38. [ "YES" ]
  39. [ "NO" ]
  40. if
  41.  
  42. print
Advertisement
RAW Paste Data Copied
Advertisement