Back
Close

A Babel of Languages on CodinGame

TBali
64.4K views

D

D

Checking the sample code

import std;
void main()
{
    string m = readln.chomp;
    string[] c = new string[2];
    c[0] = "00";
    c[1] = "0";
    char[] b;
    for (int i = 0; i < m.length; i++) {
        b ~= format("%07b", m[i]);
    }
    char[] a;
    a ~= c[b[0] - 48] ~ " 0";
    for (int i = 1; i < b.length; i++) {
        if (b[i] == b[i - 1]) {
            a ~= "0";
        } else {
            a ~= " " ~ c[b[i] - 48] ~ " 0";
        }
    }
    // To debug: stderr.writeln("Debug messages...");
    writeln(a);
}

Looking at the syntax

  • TODO

Other characteristics

  • TODO

Resources to check

Coming next...

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io