My issue
find mistake
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int x,y;
cin>>x>>y;
string a;
cin>>a;
int c1=0,max=0,streak=0;
for(int i=0;i<a.length();i++)
{
if(a[i]=='1')
{
c1++;
}
}
for(int i=0;i<a.length();i++)
{
if(a[i]=='1' && a[i+1]=='1')
{
streak++;
}
else
{
streak=1;
}
max=((max<=streak)?streak:max);
}
cout<<c1*x+max*y<<endl;
}
}
Problem Link: Chef And Salary Pay Practice Coding Problem