Editorial for COCI '15 Contest 1 #1 Karte


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

In order to determine how many cards of the same suits are missing, it is enough to read every third character from the input and add how many cards from each suit we saw from the input. In the end, we subtract the calculated number from 13 for each suit and output the result if we didn't find an error.

To check whether there is an error, it is enough to use two nested for loops to check if positions i, j exist such that the substrings of length 3 that begin at positions i, j are equal.

Alternatively, it is possible to use a two-dimensional array to store if a card of a certain suit had already been found while we input the cards from the string.


Comments

There are no comments at the moment.