LUCKYBAL: Getting wa

whats wrong in my program??

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		char s[100001];
		long long int count=0,c=0;
		cin>>s;
		count=strlen(s)*(2+(strlen(s)-1))/2;
		for(int i=0;i<strlen(s);i++)
		{
			if(s[i]=='7')
				c++;
			else
			{ count=count-(c*(c+1))/2;
			c=0;
			}
		}
		count=count-(c*(c+1))/2;
		cout<<count<<endl;
	}
	return 0;
}
1 Like

Refer the Editorails http://www.codechef.com/wiki/may-2012-cook-problem-editorials. Also try to see problem setter and tester solutions too.

2 Likes