Day 9: Round and About

The elf you helped yesterday has to go out and place his caches! He has a path to go on, but he is not sure how long it will take. Can you calculate the length of the path? Here is your test input:

Example

Input

0000.0....
...0..0..0
.0.0....0.
0..0.....0
0..00...0.
00..000.0.
0..0..0..0
.0.00.000.
..00....0.
00.0....00

Output

19

Alert: You are about to download a file that contains details needed to find this geocache. As the geocache owner, I ensure that this file is safe to download. It has not been checked by Geocaching HQ or by the reviewer for possible malicious content. Download this file at your own risk.

Download input data:

Input Data File