Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Dart
Checking the sample code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import 'dart:io';
import 'dart:math';
void main() {
// String m = stdin.readLineSync();
String m = "CG";
var c = {0 : "00", 1: "0"};
String b = "";
for(int i = 0; i < m.length; i++) {
b = b + m.codeUnitAt(i).toRadixString(2).padLeft(7, "0");
}
String a = "";
a += c[b[0].codeUnits.first - "0".codeUnits.first] + " 0";
for (int i = 1; i < b.length; i++)
if (b[i] == b[i - 1])
a += "0";
else
a += " " + c[b.codeUnitAt(i) - "0".codeUnits.first] + " 0";
print(a);
}
Enter to Rename, Shift+Enter to Preview
Looking at the syntax
- TODO
Other characteristics
- TODO
Resources to check
Coming next...
Suggested playgrounds
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content