Why does TLE show up?? Following code is in C++ 4.3.2
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string.h>
#define TMAX 1000007
#define PMAX 1000007
int main()
{
long long T;
long long i;
long long length;
long long memory;
long long count=0;
long long answer=0;
scanf("%lld",&T);
while(T--)
{
char P[PMAX]="";
answer=0;
scanf("%s",P);
length=strlen(P);
memory=0;
for(i=0;i<length;)
{
count=0;
if(P[i]=='.')
{
while(P[i++]=='.')
count++;
if(count>memory)
{
answer++;
memory=count;
}
}
else
i++;
}
printf("%lld\n",answer);
}
return EXIT_SUCCESS;
}