# Wa error in my programme

I am getiing wa in two test case and one test case got cleared what is wa and how can I eradicate it?

#include
#include
#include
using namespace std;
int bintodec(string n)
{
string num = n;
int dec_value = 0;

``````// Initializing base value to 1, i.e 2^0
int base = 1;

int len = num.length();
for (int i = len - 1; i >= 0; i--) {
if (num[i] == '1')
dec_value += base;
base = base * 2;
}

return dec_value;
``````

}
int main() {
int f;
cin>>f;
while(f!=0)
{
string a,b;
cin>>a>>b;
int count=0;
int c=bintodec(a);
int d=bintodec(b);
while(d!=0)
{
int u=c^d;
int v=c&d;
c=u;
d=v*2;
count+=1;
}
cout<<count<<endl;
f–;
}
return 0;
}

Also - what Problem are you trying to solve?

problem
my solution
#include
#include
#include
using namespace std;
int bintodec(string n)
{
string num = n;
int dec_value = 0;

``````int base = 1;

int len = num.length();
for (int i = len - 1; i >= 0; i--) {
if (num[i] == '1')
dec_value += base;
base = base * 2;
}

return dec_value;
``````

}
int main() {
int f;
cin>>f;
while(f!=0)
{
string a,b;
cin>>a>>b;
int count=0;
int c=bintodec(a);
int d=bintodec(b);
while(d!=0)
{
int u=c^d;
int v=c&d;
c=u;
d=v*2;
count+=1;
}
cout<<count<<endl;
f–;
}