Problem Statement | |||||||||||||
A string composed of the letters 'A' and 'B' is called beautiful if it satisfies all of the following criteria:
Given countA, countB, maxA and maxB, return the maximum possible length of a beautiful string. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | countA will be between 0 and 1000000, inclusive. | ||||||||||||
- | countB will be between 0 and 1000000, inclusive. | ||||||||||||
- | maxA will be between 0 and 1000000, inclusive. | ||||||||||||
- | maxB will be between 0 and 1000000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|