#include<fstream>
#include<cmath>
#include<string>
#include<iostream>
using namespace std;
ifstream fi("BAI1_15.inp");
ofstream fo("BAI1_15.out");
string s1,s2;
int kc(string s1,string s2)
{
	int i,y,kq=0;
	int t=s1.length()-s2.length();
	for(i=0;i<t;i++)
	{
		kq+=int(s1[i])-48;
	}
	for(i=t;i<s1.length();i++)
	{
		y=abs(int(s1[i])-int(s2[i-t]));
		kq+=y;
	}
	return kq;
}
int main()
{
	getline(fi,s1);
	getline(fi,s2);
	if(s1.length()>=s2.length()) fo<<kc(s1,s2);
	else fo<<kc(s2,s1);
	fi.close();
	fo.close();
}
