Please determine whether one can win with the 14 tiles in her hands or not.
In Mahhjong, there are 34 kinds of tiles, which are divided into four suites, named as bing, suo, wan, and zi. The bing, suo, wan have 9 kinds for each suite and zi tiles has only 7 kinds. To simplify the problem, each tile is represented with a number and a suite, for example 1b, 2s, 7w, 3z.
The rules in Mahhjong are similar with those in Mahjong, except that in Mahhjong there is an infinite number of each kind, while in Mahjong one kind usually contains up to 4 tiles. Also, we consider a combination of tiles winning if and only if the combination consists of four kezi or shunzi and an additional quetou.
If you are not familiar with Mahjong, here is a brief explanation:
- kezi: kezi is a set of 3 identical tiles.
For example, {1s, 1s, 1s}, {3z, 3z, 3z} are kezi, but {1s, 2s, 1s} is not.
- shunzi: shunzi is a set of 3 continuous tiles of the same suite, but please aware that suite zi cannot form shunzi.
For example, {1s, 2s, 3s}, {6b, 7b, 8b} are shunzi, but {5z, 6z, 7z} and {3w, 4w, 5s} are not.
- quetou: quetou is a pair of identical tiles:
For example, {7z, 7z}, {6w, 6w} are quetou, but {1b, 2b} is not.
- special combination (winning status): we consider a combination of tiles winning if and only if the combination consists of four kezi or shunzi and an additional quetou.
For example, {1w, 2w, 2w, 2w, 3w, 4b, 5b, 5b, 6b, 6b, 7b, 9s, 9s, 9s} is a special combination, because we can divide the set of tiles into three shunzi, a kezi and a quetou: {{1w, 2w, 3w}, {4b, 5b, 6b}, {5b, 6b, 7b}, {9s, 9s, 9s}, {2w, 2w}}