| ||You have been given a very strange computer. Its memory consists of several bits, each initially set to 0, and it can only perform the following type of operation:|
Choose one of the bits in memory, and choose a value - 0 or 1. All the bits between the selected bit and the last bit in memory, inclusive, will be set to the chosen value. For example, if the memory is "0010", and you choose the second bit and a value of 1, the memory will change to "0111".
You are given a String mem. The number of characters in mem is equal to the number of bits in the computer's memory. Return the minimum number of operations required to set the computer's memory equal to mem.
|Method signature:||int setMemory(String mem)|
|(be sure your method is public)|
|-||mem will contain between 1 and 50 characters, inclusive.|
|-||mem will contain only the characters '0' (zero) or '1' (one).|
|Choose the third bit and a value of 1.|
|No operations are needed.|