## Hamming 7 4

Statement

In a word, error correcting code are about adding bits to some bit of data in a way that if one gets changed, it is possible to know which one and fix it.
In this one, you are given 7 bits, [[c]],[[b]],[[bc]],[[a]],[[ac]],[[ab]], and [[abc]].
You first have to check if the sum of the 4 bits containing a same char are even (for exemple a, ab, ac, and abc). Do it for each char
If all the three sum are even, there are no mistake !
Otherwise, one and only one bit has been corrupted, and you have to spot which one and change it in order to make the 3 sum even.

Input description

[[c]],[[b]],[[bc]],[[a]],[[ac]],[[ab]], and [[abc]], 7 binary digits

Output description

[[c]],[[b]],[[bc]],[[a]],[[ac]],[[ab]], and [[abc]], fixed if one bit was corrupted.

Constraints

There is 0 or 1 bit corrupted in the input.

Game modes

Test cases

No mistake Test

Input

0 0 1 0 1 1 0

Output

0 0 1 0 1 1 0

Validator 1 Validator

Input

1 1 0 1 0 0 1

Output

1 1 0 1 0 0 1

Test 2 Test

Input

1 0 1 0 1 1 0

Output

0 0 1 0 1 1 0

Validator 2 Validator

Input

1 0 1 1 0 0 1

Output

0 0 1 1 0 0 1

Test 3 Test

Input

1 1 0 1 1 1 1

Output

1 1 1 1 1 1 1

Validator 3 Validator

Input

1 1 0 1 0 1 1

Output

1 1 0 1 0 0 1

Test 4 Test

Input

1 1 1 1 1 1 0

Output

1 1 1 1 1 1 1

Validator 4 Validator

Input

0 1 0 1 0 1 1

Output

0 1 0 1 0 1 0

Solution language

Solution

Stub generator input

Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!

JOIN US ON DISCORD Online Participants