The Set hole will go live in approximately . Why not try and solve it ahead of time?

Please in order to save solutions and appear on the leaderboards. New here? Check out the Tutorial hole.

Details

Given a list of mahjong hands, print out all of the hands which are complete under the rules of Riichi Mahjong.

Mahjong tiles are divided into three suits of number tiles from 1 to 9, and seven honor tiles, which are not numbered. These are the Unicode characters representing the tiles in each suit, from 1 to 9:

  • Characters 🀇🀈🀉🀊🀋🀌🀍🀎🀏
  • Bamboo 🀐🀑🀒🀓🀔🀕🀖🀗🀘
  • Circles 🀙🀚🀛🀜🀝🀞🀟🀠🀡

These are the Unicode characters representing honor tiles: 🀀🀁🀂🀃🀄🀅🀆

A triplet is a group of three identical tiles, e.g. 🀓🀓🀓 or 🀅🀅🀅. A sequence is a group of three number tiles of the same suit and with consecutive numbers, e.g. 🀇🀈🀉 or 🀜🀝🀞. A meld is either a triplet or a sequence. A pair is a group of two identical tiles.

A mahjong hand is complete if it consists of one of the following:

  • Four melds and a pair.
  • Seven distinct pairs. Four of the same tile do not count as two pairs.
  • All seven honor tiles and the 1 and 9 of each suit, plus one duplicate tile that forms a pair.

The tiles in a mahjong hand are not ordered. For example, the hand 🀇🀈🀈🀈🀉🀓🀔🀕🀚🀛🀜🀀🀀🀀 is complete, as it can be split into the groups 🀇🀈🀉 🀓🀔🀕 🀚🀛🀜 🀀🀀🀀 🀈🀈. You may assume that no hand contains more than 4 of a single tile.

The input consists of a sequence of arguments, each containing a string of 14 Unicode characters which represent the tiles in the hand. Output the arguments that represent complete mahjong hands, in the same order as they appear in the argument list.

External links: Wikipedia

152 bytes, 152 chars
Clear sample code
All
import sys

# Printing
print('Hello, World!')

# Looping
for i in range(10):
print(i)

# Accessing arguments
for arg in sys.argv[1:]:
print(arg)
1st5cw186186
2ndkg583198116
3rdovs-code199116
4thpardouin241135
5thSteffan153243147
6thSirBogman250137
7thlifthrasiir252138
Compiled from AT&T syntax to x86-64 Linux. Use syscalls to write output.
05AB1E is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
ALGOL 68 is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
APL is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Arturo is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Befunge is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
BQN is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
CJam is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
CoffeeScript is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Egel is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Erlang is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Fennel is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Groovy is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Harbour is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Hare is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Haxe is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Hush is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Hy is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
iogii is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Odin is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Picat is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Qore is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Racket is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Rebol is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Rexx is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Scala is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Squirrel is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Stax is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Uiua is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
Vyxal is an experimental language, solutions won't contribute to scoring until the language goes live. Please leave feedback on the GitHub issue.
ctrl + enter or

Delete Solution

Are you sure you want to delete your solution(s) for Mahjong?

If you have separate bytes and chars solutions then both will be deleted.

This is irreversible, please backup any code you care about.

Type I understand and press confirm to continue.