class Solution {
public:
int numberOfBeams(vector<string>& bank) {
int res=0;
int up=0;
int down=0;
for(int i=0;i<bank.size();i++)
{
for(int j=0;j<bank[0].size();j++)
{
if(bank[i][j]=='1')
{
down++;
}
}
if(down!=0)
{
res+=up*down;
up=down;
down=0;
}
}
return res;
}
};