Goats are interesting creatures. They are incredibly durable and can fall from great heights, be struck by moving vehicles, or even explode without being harmed. Goats are heralds of chaos, and leave destruction in their wake. Don’t feel bad about it; it’s just the nature of being a goat.
There are many kinds of goats that don’t look like goats, but don’t be fooled, because as the saying goes,“If it’s not a human, it’s a goat.”
You can learn more about Goats from the Official Goat Simulator wiki.
Goats are very particular about the sounds they make. Since it’s something difficult for us humans to understand, we usually simplify the goat’s sound to mere “baaaa”.
You have been observing goats for a very long time and have made transcripts of their conversations. You have written it all down in your diary.
You are afraid that a goat may see your notes through their rectangular pupils of 320-degree peripheral vision. (Yes, goats have rectangular pupils, but you have bigger problems at hand.) And so, you want to re-write your notes in a way that pleases the goats.
Given a series of lines of “baaaa’s” you have to ensure that each line adheres to the following conditions:
- If the number of a’s is not even, make it even by removing an a.
- If the number of a’s would become zero because of removing one a, add an a instead to make the number of a’s even.
- Add spaces to the beginning of each line to ensure that the baaaa’s are aligned to the center. (Do not add any extra spaces at the end of the lines.)
The input will begin with an integer N (N < 20). The following N lines will contain “baaaa’s” of varying lengths. Each line will always have exactly one b at the beginning and a number of a’s following it (at least 1). The length of a line will never exceed 20 characters.
Print the lines in the same order, but after applying the changes that would make the transcripts pleasing to the goats.
5 baaaaa baaa baaaaaaa baaaaaaaaaa baa
baaaa baa baaaaaa baaaaaaaaaa baa