I could not think of a better title.
This is a tips question. I'm asking for tips on golfing my code.
I recently took part in a code golf competition in C. The competition ended and I lost. The problem is:
Input a line with a number n.
Then input n lines, each line contains only a set of cards in descending order, e. g.
DX22AKKQJTT884443. Figure out if it contains
DXor four of the same cards in a row.
Obviously, this is a chameleon challenge (finding
DX is essentially the same as checking the second character if it is
X, and to check for four of the same cards you only need to check the first and the last card of the quadruplet, because the cards are in descending order.)
In that competition, the input format is strict, and error-terminating is disallowed.
After the competition, we continued to improve on this problem. We've got this so far (98 bytes):
I'm looking for tips to golf this down further.