Result

WA

Code [DL]

`define EOF 32'hFFFF_FFFF
`define STDIN 32'h8000_0000

module cat;
	integer c,i,d;
	initial begin
	c = 48;
		while (c != `EOF) begin
			c = $fgetc(`STDIN);
			d = 0;
			i = 1;
			while ( c == 48 || c == 49)begin
				d = d * 2;
				d = d + c - 48; 
				c = $fgetc(`STDIN);
			end
		    $write("%d\n", d);
			i = 1;

			while(d > 0)begin 
				d = d - i;
				i = i + 1;
			end

			if ( d == 0 )begin
				// $write("%c\n", "0");
		    end else begin
		    	// $write("%c\n", "1");
		    end
		end
	end
endmodule

stdin

10100001
10110111
01000010
10011110
00100100
10111010
00110111
01000010
00001111
01111000
11100001
01110011
11000101
10011001
00101101
11111101
01111000
10111011
10101011
00001010
11101111
11110110
00011100
01110010
00000001
00000000
01101011
10001101
00000110
11010010
10100111
11100111
00000011
10010000
00010010
01001110
00001000
01000000
10010011
11001000
01101001
10001000
00010101
10111110
01011011
01110101
00100101
11010100
00010111
01100010

stdout

        161
        183
         66
        158
         36
        186
         55
         66
         15
        120
        225
        115
        197
        153
         45
        253
        120
        187
        171
         10
        239
        246
         28
        114
          1
          0
        107
        141
          6
        210
        167
        231
          3
        144
         18
         78
          8
         64
        147
        200
        105
        136
         21
        190
         91
        117
         37
        212
         23
         98
          0

stderr

strace