aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-268/2colours/groovy/ch-1.groovy6
-rw-r--r--challenge-268/2colours/groovy/ch-2.groovy2
2 files changed, 4 insertions, 4 deletions
diff --git a/challenge-268/2colours/groovy/ch-1.groovy b/challenge-268/2colours/groovy/ch-1.groovy
index acaac43654..385e3f776f 100644
--- a/challenge-268/2colours/groovy/ch-1.groovy
+++ b/challenge-268/2colours/groovy/ch-1.groovy
@@ -1,9 +1,9 @@
import groovy.json.JsonSlurper
-final REPLACEMENTS = ['(': '[', ')': ']']
+final REPLACEMENTS = ['()', '[]']
def jsonSlurper = new JsonSlurper()
-def x = jsonSlurper.parseText(System.console().readLine('@x = ').replace(REPLACEMENTS))
-def y = jsonSlurper.parseText(System.console().readLine('@y = ').replace(REPLACEMENTS))
+def x = jsonSlurper.parseText(System.console().readLine('@x = ').tr(*REPLACEMENTS))
+def y = jsonSlurper.parseText(System.console().readLine('@y = ').tr(*REPLACEMENTS))
x.sort()
y.sort()
diff --git a/challenge-268/2colours/groovy/ch-2.groovy b/challenge-268/2colours/groovy/ch-2.groovy
index 667401cb24..5f679e77ac 100644
--- a/challenge-268/2colours/groovy/ch-2.groovy
+++ b/challenge-268/2colours/groovy/ch-2.groovy
@@ -1,7 +1,7 @@
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
-final REPLACEMENTS = ['()', '[]'];
+final REPLACEMENTS = ['()', '[]']
def jsonSlurper = new JsonSlurper()
def ints = jsonSlurper.parseText(System.console().readLine('@ints = ').tr(*REPLACEMENTS))