% Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
\noindent
\mbox{}\texttt{001:} \#!/usr/bin/env\ perl\ -w \\
\mbox{}\texttt{002:}  \\
\mbox{}\texttt{003:} \textbf{while\ }(\$line\ =\ $<$STDIN$>$)\ \{ \\
\mbox{}\texttt{004:} \ \ \ \ \#Input\ in\ way\ more\ every\ workable\ \textbf{format} \\
\mbox{}\texttt{005:} \ \ \ \ @numbers\ =\ \textbf{split}(\texttt{','},\$line); \\
\mbox{}\texttt{006:}  \\
\mbox{}\texttt{007:} \ \ \ \ \#Get\ the\ number\ of\ every\ colour\ in\ on\ every\ line \\
\mbox{}\texttt{008:} \ \ \ \ @colour\ =\ (0,\ 0,\ 0,\ 0,\ 0); \\
\mbox{}\texttt{009:} \ \ \ \ \textbf{foreach\ }(0,2,4,6,8)\ \{ \\
\mbox{}\texttt{010:} \ \ \ \ \ \ \ \ \$colour[\$numbers[\$$\_$]]++; \\
\mbox{}\texttt{011:} \ \ \ \ \} \\
\mbox{}\texttt{012:}  \\
\mbox{}\texttt{013:} \ \ \ \ \#Find\ pairs,\ triples,\ four \\
\mbox{}\texttt{014:} \ \ \ \ @cards\ =\ (0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0); \\
\mbox{}\texttt{015:} \ \ \ \ \textbf{foreach\ }(1,3,5,7,9)\ \{ \\
\mbox{}\texttt{016:} \ \ \ \ \ \ \ \ \$cards[\$numbers[\$$\_$]]++; \\
\mbox{}\texttt{017:} \ \ \ \ \} \\
\mbox{}\texttt{018:}  \\
\mbox{}\texttt{019:} \ \ \ \ \#\#\#\ BEGIN\ Specials\ \#\#\# \\
\mbox{}\texttt{020:} \ \ \ \ \#triple\ =\ 1,\ four\ =\ 2 \\
\mbox{}\texttt{021:} \ \ \ \ \$special\ =\ 0; \\
\mbox{}\texttt{022:} \ \ \ \ \#one\ pair\ =\ 1,\ two\ pair\ =\ 2 \\
\mbox{}\texttt{023:} \ \ \ \ \$pairs\ =\ 0; \\
\mbox{}\texttt{024:} \ \ \ \ \#\#\#\ END\ Specials\ \#\#\# \\
\mbox{}\texttt{025:}  \\
\mbox{}\texttt{026:} \ \ \ \ \#\#\#\ BEGIN\ decoded\ specials\ \#\#\# \\
\mbox{}\texttt{027:} \ \ \ \ \$onepair\ =\ 0; \\
\mbox{}\texttt{028:} \ \ \ \ \$twopair\ =\ 0; \\
\mbox{}\texttt{029:} \ \ \ \ \$triple\ =\ 0; \\
\mbox{}\texttt{030:} \ \ \ \ \$four\ =\ 0; \\
\mbox{}\texttt{031:} \ \ \ \ \#\#\#\ END\ decoded\ specials\ \#\#\# \\
\mbox{}\texttt{032:}  \\
\mbox{}\texttt{033:} \ \ \ \ \textbf{foreach\ }(1\ ..\ 13)\ \{ \\
\mbox{}\texttt{034:} \ \ \ \ \ \ \ \ \textbf{if}\ (\$cards[\$$\_$]\ ==\ 2)\ \{ \\
\mbox{}\texttt{035:} \ \ \ \ \ \ \ \ \ \ \ \ \$pairs++; \\
\mbox{}\texttt{036:} \ \ \ \ \ \ \ \ \ \ \ \ \textbf{if}\ (\$pairs\ ==\ 1)\ \{ \\
\mbox{}\texttt{037:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$onepair\ =\ 1; \\
\mbox{}\texttt{038:} \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textbf{elsif\ }(\$pairs\ ==\ 2)\ \{ \\
\mbox{}\texttt{039:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$twopair\ =\ 1; \\
\mbox{}\texttt{040:} \ \ \ \ \ \ \ \ \ \ \ \ \} \\
\mbox{}\texttt{041:} \ \ \ \ \ \ \ \ \}\ \textbf{elsif\ }(\$cards[\$$\_$]\ $>$\ 2)\ \{ \\
\mbox{}\texttt{042:} \ \ \ \ \ \ \ \ \ \ \ \ \$special\ =\ \$cards[\$$\_$]; \\
\mbox{}\texttt{043:} \ \ \ \ \ \ \ \ \ \ \ \ \textbf{if}\ (\ \$special\ ==\ 3)\ \{ \\
\mbox{}\texttt{044:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$triple\ =\ 1; \\
\mbox{}\texttt{045:} \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textbf{elsif\ }(\$special\ ==\ 4)\ \{ \\
\mbox{}\texttt{046:} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \$four\ =\ 1; \\
\mbox{}\texttt{047:} \ \ \ \ \ \ \ \ \ \ \ \ \} \\
\mbox{}\texttt{048:} \ \ \ \ \ \ \ \ \} \\
\mbox{}\texttt{049:} \ \ \ \ \} \\
\mbox{}\texttt{050:}  \\
\mbox{}\texttt{051:} \ \ \ \ \#Decode\ into\ split\ option\ array \\
\mbox{}\texttt{052:} \ \ \ \ @output\ =\ (0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0,\ 0); \\
\mbox{}\texttt{053:} \ \ \ \ \$output[\$numbers[10]]++; \\
\mbox{}\texttt{054:}  \\
\mbox{}\texttt{055:} \ \ \ \ \$pairs\ /=\ 10; \\
\mbox{}\texttt{056:} \ \ \ \ \$special\ /=\ 10; \\
\mbox{}\texttt{057:} \ \ \ \ \textbf{foreach\ }(0\ ..\ 10)\ \{ \\
\mbox{}\texttt{058:} \ \ \ \ \ \ \ \ \$numbers[\$$\_$]\ /=\ 10; \\
\mbox{}\texttt{059:} \ \ \ \ \} \\
\mbox{}\texttt{060:} \ \ \ \ \textbf{foreach\ }(0\ ..\ 4)\ \{ \\
\mbox{}\texttt{061:} \ \ \ \ \ \ \ \ \$colour[\$$\_$]\ /=\ 10; \\
\mbox{}\texttt{062:} \ \ \ \ \} \\
\mbox{}\texttt{063:}  \\
\mbox{}\texttt{064:} \ \ \ \ \#\ Input\ 10\ \ :\ all\ cards \\
\mbox{}\texttt{065:} \ \ \ \ \#\ Output\ 1\ \ :\ decoded\ version\ of\ result \\
\mbox{}\texttt{066:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..10]\textbackslash{}n"{}}; \\
\mbox{}\texttt{067:}  \\
\mbox{}\texttt{068:} \ \ \ \ \#\ Input\ 10\ \ :\ all\ cards \\
\mbox{}\texttt{069:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ one\ node \\
\mbox{}\texttt{070:} \ \ \ \ print\ \texttt{"{}@numbers[0..9]\ @output[0..9]\textbackslash{}n"{}}; \\
\mbox{}\texttt{071:}  \\
\mbox{}\texttt{072:} \ \ \ \ \#\ Input\ 14\ \ :\ all\ cards\ +\ colours \\
\mbox{}\texttt{073:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ one\ node \\
\mbox{}\texttt{074:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ @output[0..9]\textbackslash{}n"{}}; \\
\mbox{}\texttt{075:}  \\
\mbox{}\texttt{076:} \ \ \ \ \#\ Input\ 16\ \ :\ all\ cards\ +\ specials \\
\mbox{}\texttt{077:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
\mbox{}\texttt{078:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ \$pairs\ \$special\ @output[0..9]\textbackslash{}n"{}}; \\
\mbox{}\texttt{079:}  \\
\mbox{}\texttt{080:} \ \ \ \ \#\ Input\ 14\ \ :\ all\ cards\ +\ decoded\ specials \\
\mbox{}\texttt{081:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
\mbox{}\texttt{082:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ \$onepair\ \$twopair\ \$triple\ \$four\ @output[0..9]\textbackslash{}n"{}}; \\
\mbox{}\texttt{083:}  \\
\mbox{}\texttt{084:} \ \ \ \ \#\ Input\ 18\ \ :\ all\ cards\ +\ colour\ +\ decoded\ specials \\
\mbox{}\texttt{085:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
\mbox{}\texttt{086:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ \$onepair\ \$twopair\ \$triple\ \$four\ @output[0..9]\textbackslash{}n"{}}; \\
\mbox{}\texttt{087:}  \\
\mbox{}\texttt{088:} \ \ \ \ \#\ Input\ 10:\ all\ cards \\
\mbox{}\texttt{089:} \ \ \ \ \#\ output\ 2:\ full\ house,\ four\ of\ a\ kind \\
\mbox{}\texttt{090:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ \$output[6]\ \$output[7]\textbackslash{}n"{}}; \\
\mbox{}\texttt{091:}  \\
\mbox{}\texttt{092:} \ \ \ \ \#\ Input\ 16\ :\ all\ cards\ +\ specials \\
\mbox{}\texttt{093:} \ \ \ \ \#\ output\ 1\ :\ full\ house \\
\mbox{}\texttt{094:} \ \ \ \ \#print\ \texttt{"{}@numbers[0..9]\ @colour[1..4]\ \$pairs\ \$special\ \$output[7]\textbackslash{}n"{}}; \\
\mbox{}\texttt{095:}  \\
\mbox{}\texttt{096:} \ \ \ \ \#\ Input\ 2\ \ :\ Calculated\ set \\
\mbox{}\texttt{097:} \ \ \ \ \#\ output\ 1\ :\ full\ house \\
\mbox{}\texttt{098:} \ \ \ \ \#print\ \texttt{"{}\$pair\ \$special\ \$output[6]\textbackslash{}n"{}}; \\
\mbox{}\texttt{099:}  \\
\mbox{}\texttt{100:} \ \ \ \ \#\ Input\ \ 8\ \ :\ colour\ +\ decoded\ specials \\
\mbox{}\texttt{101:} \ \ \ \ \#\ Output\ 10\ :\ all\ options,\ every\ has\ it's\ one\ node \\
\mbox{}\texttt{102:} \ \ \ \ \#print\ \texttt{"{}@colour[1..4]\ \$onepair\ \$twopair\ \$triple\ \$four\ @output[0..9]\textbackslash{}n"{}}; \\
\mbox{}\texttt{103:} \} \\

