Click Here to go back to the homepage.

EpigDanceOff Solution:


#include <bits/stdc++.h>
using namespace std;

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int rows, cols;
    cin >> rows >> cols;
    cin.get(); //read newline
    unordered_set<int> frame_separator_indices;


    for (int i = 0; i < cols; ++i)
    {
    	char c;
    	cin.get(c);
    	if(c == '_'){
    		frame_separator_indices.insert(i); 
    	}
    }
    for (int row = 1; row < rows; ++row)
    {
    	cin.get(); //read newline
    	for (int col = 0; col < cols; ++col)
    	{
    		char c;
    		cin.get(c);
    		if(c != '_'){
    			frame_separator_indices.erase(col);
    		}
    	}
    }
    cout << frame_separator_indices.size() + 1;

	return 0;
}