eolymp
bolt
Try our new interface for solving problems
Problems

Fence Repairing

Fence Repairing

You are going to repair an old fence. The fence consists of several consecutive boards, some of which are broken and some of which are fine. The boards are numbered from left to right in increasing order. To repair all the boards between $i$ and $j$, inclusive, where $j$ is greater than or equal to $i$, a woodworker charges $\sqrt{j - i + 1}$. Due to the woodworker's pricing scheme, it is often necessary to repair boards even if they are not broken in order to get the best price. You will be given the information about the fence. Broken boards are represented by "\textbf{X}" characters and good boards are represented by "\textbf{.}" characters. Find the minimal cost required to repair all broken boards. \InputFile Each line is a separate test that represents the fence. It contains the characters "\textbf{X}" and "\textbf{.}" only. The length of each fence is no more than $2500$ symbols. \OutputFile For each test case in a separate line print the minimal cost required to repair all broken boards with $4$ digits after the decimal point.
Time limit 1 second
Memory limit 128 MiB
Input example #1
X.X...X.X
X.X.....X
X.............XX.X.......X...X..
Output example #1
3.0000
2.7321
5.0000