/*#include<bits/stdc++.h>
using namespace std;
bool check(string a,string b,string c);


int main()
{
   // freopen("input.txt", "r", stdin);
string a,b,c;
cin>>a>>b>>c;
if(check(a,b,c))
{
    cout<<"0";
    return 0;
}
vector<string> v;
for(int i=1;i<=9;i++)
{
  string s="";
  s +=i+'0';
  v.push_back(s+"s");
  v.push_back(s+"m");
  v.push_back(s+"p");    
}
vector <string>::iterator i;
for(i=v.begin();i!=v.end();i++)
{
    if(check(*i,a,b))
    {
        cout<<"1";
        return 0;
    }
    if(check(*i,a,c))
    {
        cout<<"1";
        return 0;
    }
    if(check(*i,b,c))
    {
        cout<<"1";
        return 0;
    }
}
cout<<"2";
return 0;
}

bool check(string a,string b,string c)
{
  if(a==b&&b==c)
  return true;
  if(a>b)
  swap(a,b);
  if(b>c)
  swap(b,c);
  if(a>b)
  swap(a,b);
 if(a[1]==b[1]&&b[1]==c[1])
 { 
  if((a[0]=b[0]+1)&&(b[0]=c[0]+1))
  return true;
 }
 return false;
}
*/
/* 
#include<bits/stdc++.h>
using namespace std;
void set_key(int array[],string str);
int main()
{
    int q;
    cin>>q;
    for(int i=0;i<q;i++)
    {
        string string_s,string_t,string_p;
        int record[26]={},compare[26]={};
        bool condition1=true,condition2=true;
        cin>>string_s;
        cin>>string_t;
        cin>>string_p;
        set_key(record,string_s);
        set_key(compare,string_t);
         int j=0;

        for( j=0;j<26;j++)
        {
            record[j]=compare[j]-record[j];
        }

        for(j=0;j<26;j++)
        {
            if(record[j]<0)
            {
                condition1=false;
                break;
            }
        }   
        string_s=string_s+string_p;
        memset(record,0,sizeof(record));
        memset(compare,0,sizeof(compare));
        set_key(record,string_s);
        set_key(compare,string_t);
        for( j=0;j<26;j++)
        {
            record[j]=compare[j]-record[j];
        }
        for(j=0;j<26;j++)
        {
            if(record[j]>0)
            {
                condition2=false;
                break;

            }
        }
        if(condition1&&condition2)
        cout<<"YES";
        else
        cout<<"NO";
        
         }
}

void set_key(int array[],string str)
{
    for(int i=0;i<str.length();i++)
     array[str[i]-97]++;   
} */
/* #include<bits/stdc++.h>
using namespace std;
int get_number(string pow);
int multiply(int first,int current,int number);
void remove_zero(string s,int flag);
int main()
{
    string barn;
    string a,d, b;   //format is a.deb
    cin>>barn;
     int power;
    int i=0;
    while (barn[i]!='.')
    {
        a=a+barn[i];
        i++;
    }
    i++;
    while(barn[i]!='e')
    {
        d=d+barn[i];
        i++;
    }
    i++;
    while (i!=barn.size())
    {
      b=b+barn[i];
      i++;
    }
    power= get_number(b);
    if(power==d.size())
    {
        a=a+d;
        remove_zero(a,1);
    }
    if(power<d.size())
    {
        
        
        for(int j=0;j<d.size();j++)
        {
            a=a+d[j];
            if(j==power-1)
            a=a+".";
        }
        remove_zero(a,0);
    }
    if(power>d.size())
    {
        int diff= power-d.size();
        a=a+d;
    
        for(int j=0;j<diff;j++)
        a=a+"0";
       remove_zero(a,1);
    }
    cout<<endl;
}

int get_number(string pow)
{
 int number,power=0;
   for(int i=pow.size()-1;i>=0;i--)
   {
         number=pow[i]-48;
         power=power+multiply(pow.size()-1,i,number);
   }
   return power;
}

int multiply(int first,int current,int number)
{
   while(current!=first)
   {
       number=number*10;
       current++;
   }
   return number;
}

void remove_zero(string s,int flag)
{
    if(flag==0)//the tailing zeroes neeed to be removed till the decimal
    {
        if(s[0]=='0')
         cout<<"0";

        for(int i=0;i<s.size();i++)
        {

                
                
            while(s[i]=='0'||s[i]!='.')
                 i++;
            
            cout<<s[i];
        }
    }
    else
 BITS/TR   {
 for(int i=0;i<s.size();i++)
 {
     if(s[0]=='0')
     {
         while(s[i]=='0')
         i++;
     }
     cout<<s[i];
 }   
    }
}*/
/* *
#include<bits/stdc++.h>
using namespace std;
class heap
{
    private:
    int *arr;
    int heap_len;
    int heap_size;
    public:
    void input_heap_len(int n);

    void print_heap(void);

    void input_heap_member(void );

    int max_heapify(int pos );

    void build_max_heap(void);

    void heap_sort(void);
};

void heap::input_heap_len(int n)
{
    heap_size=n;
    heap_len=n;
}

void heap::input_heap_member(void)
{
    cout<<heap_len;
    for(int i=0;i<heap_len;i++)
    cin>>arr[i];
}

int heap::max_heapify(int pos)
{
 int left,right,largest=pos;
  
  left=2*pos+1;
  right=2*pos+2;
  
  if(left<=heap_size && arr[left]>arr[largest])
  largest=left;
  
  if(right<=heap_size && arr[right]>arr[largest])
  largest =right;

   cout<<"The largest element is :"<<arr[largest]<<endl;
  if(largest!=pos)
  {
      
      max_heapify(largest);
  }  
  return 1;
}

void heap::build_max_heap(void)
{

  cout<<heap_size;
  for(int i=(heap_size/2 )-1;i>=0;i--)
  max_heapify(i);
}

void heap::heap_sort(void)
{
    build_max_heap();
    for(int i=heap_len-1;i<=1;i--)
    {
        int temp;
      temp=arr[i];
      arr[i]=arr[0];
      arr[0]=temp;
      max_heapify(0);
      heap_size--;
    }
}
void heap::print_heap(void)
{
    for(int i=0;i<heap_len;i++)
       cout<<arr[i]<<" ";

       cout<<endl;
}

int main()
{
    heap h;
    int n;
    cin>>n;
    h.input_heap_len(n);
    h.input_heap_member();
    //h.max_heapify(2);
   // h.build_max_heap();
   // h.heap_sort();
    h.print_heap();

}*/
/* 
#include<bits/stdc++.h>
using namespace std;
typedef void (*functionPointer)(int a,int b);

void printFunction(functionPointer cf);

void addint(int a,int b);

int main()
{
  functionPointer cf =addint;
//  printFunction(addint);
printFunction(cf);  
}
void addint(int a,int b)
{
       cout<<a+b<<endl;
}

void printFunction(functionPointer cf)
{
     cf(2,3);  
}*/
#include"bits/stdc++.h"
using namespace std;
int main()
{
    string string1,string2;
    cin>>string1>>string2;
    int count=0;
    for(int i=0;i<3;i++)
     if(string1[i]==string2[i])
     count++;

     cout<<count<<endl;
}

Measured memory_bytes: 256