Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Checking the sample code
Note: my solution is almost Java. A more idiomatic Groovy-like solution is needed here to show...
inp = new Scanner(System.in)
m = inp.nextLine()
c = ["00", "0"]
b = ""
for (char w : m)
b = b.concat(Integer.toBinaryString((int)w).padLeft(7,'0'))
a = c[(int)b.charAt(0) - (int)'0'] + " 0"
for (i = 1; i < b.length(); i++)
if (b.charAt(i) == b.charAt(i - 1))
a = a.concat("0")
a = a.concat(" " + c[(int)b.charAt(i) - (int)'0'] + " 0")
Enter to Rename, Shift+Enter to Preview
Looking at the syntax
Resources to check
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content