part2 (3335B)
1--- Part Two --- 2 3Now, you're ready to [1m[37mcheck the image for sea monsters[0m. 4 5The borders of each tile are not part of the actual image; start by removing them. 6 7In the example above, the tiles become: 8 9.#.#..#. ##...#.# #..##### 10###....# .#....#. .#...... 11##.##.## #.#.#..# #####... 12###.#### #...#.## ###.#..# 13##.#.... #.##.### #...#.## 14...##### ###.#... .#####.# 15....#..# ...##..# .#.###.. 16.####... #..#.... .#...... 17 18#..#.##. .#..###. #.##.... 19#.####.. #.####.# .#.###.. 20###.#.#. ..#.#### ##.#..## 21#.####.. ..##..## ######.# 22##..##.# ...#...# .#.#.#.. 23...#..#. .#.#.##. .###.### 24.#.#.... #.##.#.. .###.##. 25###.#... #..#.##. ######.. 26 27.#.#.### .##.##.# ..#.##.. 28.####.## #.#...## #.#..#.# 29..#.#..# ..#.#.#. ####.### 30#..####. ..#.#.#. ###.###. 31#####..# ####...# ##....## 32#.##..#. .#...#.. ####...# 33.#.###.. ##..##.. ####.##. 34...###.. .##...#. ..#..### 35 36Remove the gaps to form the actual image: 37 38.#.#..#.##...#.##..##### 39###....#.#....#..#...... 40##.##.###.#.#..######... 41###.#####...#.#####.#..# 42##.#....#.##.####...#.## 43...########.#....#####.# 44....#..#...##..#.#.###.. 45.####...#..#.....#...... 46#..#.##..#..###.#.##.... 47#.####..#.####.#.#.###.. 48###.#.#...#.######.#..## 49#.####....##..########.# 50##..##.#...#...#.#.#.#.. 51...#..#..#.#.##..###.### 52.#.#....#.##.#...###.##. 53###.#...#..#.##.######.. 54.#.#.###.##.##.#..#.##.. 55.####.###.#...###.#..#.# 56..#.#..#..#.#.#.####.### 57#..####...#.#.#.###.###. 58#####..#####...###....## 59#.##..#..#...#..####...# 60.#.###..##..##..####.##. 61...###...##...#...#..### 62 63Now, you're ready to search for sea monsters! Because your image is monochrome, a sea monster will 64look like this: 65 66 # 67# ## ## ### 68 # # # # # # 69 70When looking for this pattern in the image, [1m[37mthe spaces can be anything[0m; only the # need 71to match. Also, you might need to rotate or flip your image before it's oriented correctly to find 72sea monsters. In the above image, [1m[37mafter flipping and rotating it[0m to the appropriate 73orientation, there are [1m[37mtwo[0m sea monsters (marked with [1m[37mO[0m): 74 75.####...#####..#...###.. 76#####..#..#.#.####..#.#. 77.#.#...#.###...#.##.[1m[37mO[0m#.. 78 79#.[1m[37mO[0m.##.[1m[37mO[0m[1m[37mO[0m#.#.[1m[37mO[0m[1m[37mO[0m.##.[1m[37mO[0m[1m[37mO[0m[1m[37mO[0m## 80 81..#[1m[37mO[0m.#[1m[37mO[0m#.[1m[37mO[0m##[1m[37mO[0m..[1m[37mO[0m.#[1m[37mO[0m##.## 82...#.#..##.##...#..#..## 83#.##.#..#.#..#..##.#.#.. 84.###.##.....#...###.#... 85#.####.#.#....##.#..#.#. 86##...#..#....#..#...#### 87..#.##...###..#.#####..# 88....#.##.#.#####....#... 89..##.##.###.....#.##..#. 90#...#...###..####....##. 91.#.##...#.##.#.#.###...# 92#.###.#..####...##..#... 93#.###...#.##...#.##[1m[37mO[0m###. 94 95.[1m[37mO[0m##.#[1m[37mO[0m[1m[37mO[0m.###[1m[37mO[0m[1m[37mO[0m##..[1m[37mO[0m[1m[37mO[0m[1m[37mO[0m##. 96 97..[1m[37mO[0m#.[1m[37mO[0m..[1m[37mO[0m..[1m[37mO[0m.#[1m[37mO[0m##[1m[37mO[0m##.### 98#.#..##.########..#..##. 99#.#####..#.#...##..#.... 100#....##..#.#########..## 101#...#.....#..##...###.## 102#..###....##.#...##.##.# 103 104Determine how rough the waters are in the sea monsters' habitat by counting the number of # that are 105[1m[37mnot[0m part of a sea monster. In the above example, the habitat's water roughness is 106[1m[37m273[0m. 107 108[1m[37mHow many # are not part of a sea monster?[0m 109 110