|Online Judge||Problem Set||Authors||Online Contests||User|
WFF 'N PROOF
WFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (WFF) is any string of these symbols obeying the following rules:
Given a collection of symbols resulting from throwing a set of dice, determine the longest WFF that can be formed from those symbols.
Input consists of several test cases. Each test case is a single line containing a string containing between 1 and 100 of the characters. A line containing 0 follows the last case.
For each test case, output a line containing the longest WFF that can be formed using some subset of the letters in the string. If there are several such WFFs, any one will do. If no WFF can be constructed, output a line containing "no WFF possible" as shown below.
qKpNq KKN 0
KqNq no WFF possible
Waterloo Local Contest, 2006.9.24
[Submit] [Go Back] [Status] [Discuss]
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator