June cook off 2013 Attic Crossing Problem

#include
#include

using namespace std;

int main()
{
long long int t,l,d,ba,sm;
string s;
cin>>t;
while(t–)
{
cin>>s;
d=0;ba=0;sm=0;
l=s.length();
for(long long int i=1;i<l;i++)
{
if(s[i]==’#’)
{
if(ba<sm)
{
d+=1;
ba=sm;
sm=0;
}
}
else
{
sm+=1;

		}
	}
	
	cout<<d<<endl;	
}
return 0;

}

Try to print the output in a text file i.e. output.txt. See if it matches the expected output exactly.

givng expected output bt showing wrong answer