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", "1");
		    end else begin
		    	$write("%c\n", "0");
		    end
		end
	end
endmodule

stdin

00000001
11000100
00111010
10101011
00000110
00100100
01011011
01111000
10000010
01001110
01101001
00011100
00010101
11111101
11110101
10011010
11100001
00001111
00000000
00001111
10100111
01010000
00100111
11100111
00100000
10011101
00101101
01110110
10000001
10111110
01000010
10110011
00110111
11101000
10011001
10001111
11110110
00001100
01101001
10110010
10001010
10001000
00000011
00001000
00001010
10010000
01100111
11100110
00010000
11010010

stdout

1
0
0
1
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
0
0
0
1
0
0
1
0
0
1
1
0
1
0
1
0
0
0
1
0
0
1
1
0
1
0
0
0
0
1
1

stderr

strace