fork download
  1. import std.stdio;
  2. import std.conv;
  3. import std.math;
  4. import std.algorithm.iteration;
  5. import std.format;
  6.  
  7. void main()
  8. {
  9.  
  10. enum x = -123;
  11. enum s = format("%s+%s+(%s%s)", x, x.to!string.length, x < 0 ? "-" : "", x.abs.to!string.map!(to!string).joiner("+"));
  12. writefln("%s=%s", s, mixin(s));
  13. }
  14.  
Success #stdin #stdout 0s 2740KB
stdin
Standard input is empty
stdout
-123+4+(-1+2+3)=-115