The problem statement contains images best viewed in the applet.
Triominoes is a game similar to dominoes. The game pieces are equilateral triangles with a number between 0 and 6, inclusive, in each vertex. When pieces are played, each pair of vertices from different triangles that touch each other must contain the same number.
An important part of the game is making regular hexagons, each consisting of six pieces. In each hexagon, six vertices from six triangles meet at the center, and those six vertices contain the same number. At each vertex of the hexagon, two vertices from adjacent triangles touch each other, and those two vertices contain the same number.
You will be given a String pieces containing a set of triomino pieces and you must return the number of different hexagons that can be formed with that set. Each element of pieces will be formatted "XYZ" (quotes for clarity) where X, Y and Z are the numbers in the vertices of a single piece in clockwise order. Pieces can be rotated but not flipped. For example, pieces "123" and "312" are the same, but they are different from "321". Two hexagons are considered the same if one can be rotated to look exactly like the other. See examples for further clarification.