Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I heard somewhere that one thing that technology cannot do yet is fold towels1. So it is now your job to prove that statement false!
1: This has been disproved by Geobits and Laikoni. However, I did hear it somewhere.
I heard somewhere that one thing that technology cannot do yet is fold towels. So it is now your job to prove that statement false!
Input: +------+ | | | | | | | | | | | | +------+ Output: +--+ | | | | +--+ Input: +--+ +--+ +--+ | | | | | | | | | | | | +--+ +--+ +--+ Output: ++ ++ ++ ++ ++ ++ Input: +----+ | | | | | | | | ++ +----+ ++ Output: +-+ | | +-+ + Input: +--+ +--+ ++ || || ++ Output: ++ + +
Input: +------+ | | | | | | | | | | | | +------+ Output: +--+ | | | | +--+ Input: +--+ +--+ +--+ | | | | | | | | | | | | +--+ +--+ +--+ Output: ++ ++ ++ ++ ++ ++ Input: +----+ | | | | | | | | ++ +----+ ++ Output: +-+ | | +-+ +
Standard methods of input/output.
Standard loopholes apply.
Input and output should be as a string.
Trailing whatevers are okay in output, as long as the towels are in the right place relative to each other.
You may assume that the length of each side of the towel will always be divisible by 2.
The towels passed as input will always be rectangular.
The towels will always be separated-- however, they may be separated by variable amounts.
code-golf, so shortest code wins!