Broken Keyboard

Problem #428

Tags: strings implementation

Who solved this?

No translations... yet
ctrl-alt-del joke keyboard
Just a bearded joke :)

Another problem from "coding" interview section with T-Bank, it preceded Cheapest Bus Tickets and is simpler but allows a handful of implementations, differing in their qualities.

Paolo Durno founds his keyboard has a key B broken. But it not simply just "not types in the char"! Besides this obvious effect, it mystically deletes some one of preceding characters: either the nearest previous capital or small letter, depending on whether the button was pressed with Shift or without (i.e. whether B or b was to be typed).

The goal is, by the given string, to produce the result of typing it with this curious keyboard.

Input provides a count of testcases to follow in the first line.
Next lines contain single testcase each, in a form of strings, constiting only of latin letters.

Answer should provide resulting malformed strings, space separated.

Example:

input:

1
YetAnotherBrokenKeyboard

answer:

YetnotherrokenKeoard
You need to login to get test data and submit solution.