Solved by 51 users: ...
UserDateAttemptTimeCMSC
ignat`02 nov 2010`C++4100.59110
ignat`02 nov 2010`C++3500.56114
stasg7`21 jan 2011`C600.54115
ignat`02 nov 2010`C++3200.47117
ignat`02 nov 2010`C++3300.47117
stasg7`22 apr 2010`C++100.54124
tttttt`07 may 2011`C++1900.19148
mikelan`21 feb 2012`C400.28148
ignat`24 apr 2010`C++1300.47148
strider`22 apr 2010`C100.55149
decoherence`11 sep 2010`C1900.30152
decoherence`11 sep 2010`C2300.30154
ripatti`23 apr 2010`C++600.33160
Grinchuk_175`24 dec 2011`C++1800.39160
ripatti`23 apr 2010`C++700.30163
evg281`04 may 2010`C++700.65164
JohnJones_001`01 aug 2011`C400.37174
ripatti`23 apr 2010`C++500.27177
 C++ 37 C 13 Java 2
` >  >  >  >  >  >  >  >  >  > `

## Islands

Time limit = 1 second(s)

Memory limit = 33000 Kb

The scientists from Institute of Geodesy and Cartography made a satellite picture of some part of the Pacific Ocean. Then they composed a map of islands. But the map occurred quite large and they asked you for help. Do count a number of islands on the map.

Island is a set of square cells of land, where each cell is reachable from another by land. Each island is surrounded by water. No two islands contact by their corners. There are no lakes inside an island.

Input In the first line there are two space-separated numbers N and M — the hight and the width of a map ( 1 ≤ N, M ≤ 5000 ). Each of the next N lines contains M symbols describing the map: "~" stands for water, "*" stands for land.

Output The number of islands.

 Input#1```7 6 ~~~~~~ ~*~**~ ~***~~ ~~~~~~ ~*~~*~ ~**~*~ ~~~~~~ ``` Output#1```3 ```

Author:
Classical problem. Prepared by Semyonov Stanislav.
April 8, 2010

 © acm.mipt DevGroupThe page was generated in 190ms