I have string (c++ programming) that represent key press events: X, Y, DEL I have to print "X" if-and-only-if an event X was received, but no Y event preceded or succeeded it for two events.
For example:
"DEL DEL X DEL DEL Y " => outputs "X"
"DEL DEL X DEL Y DEL" => no outputs
"Y DEL X DEL DEL DEL" => no outputs
"X X X X X X "=> outputs "XXXXXX"
how should i do that? i got difficulty to parse and search the string thanks
A simple parser:
Sample usage:
The
operate on keys
is the hard part: With the list of keys, you need to figure out what to output. Come back with some code and we can help you out with it.