Can u tell me whats wrong with the code below , the code is accepted but giving an execution time of 2.53 sec ! How can i optimize it ? Provide some tips !
int main(){
int t ;
cin>>t;
getchar();
while(t--){ int days=0,max=0,len=0; char ch;
while((ch = getchar()) != '\n') {
if(ch=='.' )
{
len++; }
else
{ if(len>max){days++; max=len;} len=0;}
}
cout<<days<<endl;
} //system("PAUSE");
}