Just in time processing on a character stream: Difference between revisions
Content added Content deleted
(fix English in problem description) |
|||
Line 1: | Line 1: | ||
{{draft task}} |
{{draft task}} |
||
Given a stream of characters |
Given a stream of characters containing the separator characters "formfeed", "linefeed", "tab" and "space", print out the i<sup>th</sup> character of the i<sup>th</sup> tab-field of the i<sup>th</sup> line of the i<sup>th</sup> page to reveal a secret password. |
||
Stop processing immediately upon encountering a "!" found uniquely in this <i>i,i,i,i</i> position ( |
Stop processing immediately upon encountering a "!" found uniquely in this <i>i,i,i,i</i> position (lest the system self-destruct). The "!" may be found elsewhere however, in which case it should be ignored. |
||
Ideally this can be |
Ideally this can be generalised as follows: |
||
* The |
* The separator characters are defined by a user-supplied array that can include additional or alternative separators, e.g. (formfeed, linefeed, ".", "," ," ",...). |
||
* |
* The selection criterion is generalised i<sup>th</sup>,i<sup>th</sup>,i<sup>th</sup>,i<sup>th</sup> to a boolean function of <i>f(page,line,field,word,...) <b>or</b> f(i<sup>th</sup>,j<sup>th</sup>,k<sup>th</sup>,l<sup>th</sup>,m<sup>th</sup>,etc...)</i> |
||
Provide a reasonably interesting message to be decoded, e.g. Silence-Dogood. Your choice. |
Provide a reasonably interesting message to be decoded, e.g. "Silence-Dogood". Your choice. |
||
This task was inspired by the movie "[[wp:National_Treasure_%28film%29|National Treasure]]" |
This task was inspired by the movie "[[wp:National_Treasure_%28film%29|National Treasure]]", which refers to a "[[wp:Book cipher|book cipher]]". |
||
=={{header|C}}== |
=={{header|C}}== |