Problem:
Score : 100 points

Problem Statement

You will be given a string S of length 3 representing the weather forecast for three days in the past.

The i-th character (1 \leq i \leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.

You will also be given a string T of length 3 representing the actual weather on those three days.

The i-th character (1 \leq i \leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.

Print the number of days for which the forecast was correct.

Constraints

S and T are strings of length 3 each.

S and T consist of S, C, and R.

Input

Input is given from Standard Input in the following format:

S
T

Output

Print the number of days for which the forecast was correct.

Sample Input 1

CSS
CSR

Sample Output 1

2

For the first day, it was forecast to be cloudy, and it was indeed cloudy.

For the second day, it was forecast to be sunny, and it was indeed sunny.

For the third day, it was forecast to be sunny, but it was rainy.

Thus, the forecast was correct for two days in this case.

Sample Input 2

SSR
SSR

Sample Output 2

3

Sample Input 3

RRR
SSS

Sample Output 3

0

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC139.A();
        }


        class ABC139
        {
            public static void A()
            {
                var S = Read.Str();
                var T = Read.Str();
                Console.WriteLine(Enumerable.Range(0, 3).Count(i => S[i] == T[i]));
            }
            public static void B()
            {
                var A = Read.Int();
                var B = Read.Int();
                Console.WriteLine((B - 1 + A - 2) / (A - 1));
            }
            public static void C()
            {
                var N = Read.Int();
                var H = Read.IntN();
                int max = 0;
                int current = 0;
                for(int i = 0; i < N - 1; ++i)
                {
                    if (H[i] >= H[i + 1])
                    {
                        current++;
                        max = Math.Max(max, current);
                    }
                    else
                    {
                        current = 0;
                    }
                }
                Console.WriteLine(max);
            }
            public static void D()
            {
                var N = Read.Long();
                Console.WriteLine(N * (N - 1) / 2);
            }
            public static void E()
            {
                var N = Read.Int();
                Func<int, int, int> key = (i, j) => i > j ? j * N + i : i * N + j;
                Dictionary<int, HashSet<int>> Adj = new Dictionary<int, HashSet<int>>();
                for(int i = 0; i < N; ++i)
                {
                    for(int j = i + 1; j < N; ++j)
                    {
                        var k = key(i, j);
                        Adj.Add(k, new HashSet<int>());
                    }
                }
                for(int i = 0; i < N; ++i)
                {
                    var A = Read.IntN();
                    for(int k = 0; k < N - 2; ++k)
                    {
                        var k1 = key(i, A[k] - 1);
                        var k2 = key(i, A[k + 1] - 1);
                        Adj[k1].Add(k2);
                    }
                }
                var done1 = new bool[N * N];
                var done2 = new bool[N * N];
                var history = new Stack<int>();
                var top = Util.TopologicalSort(Adj, 1, done1, done2, history);
                if (!top) { Console.WriteLine(-1); return; }
                var dp = new int[N * N];
                while (history.Count > 0)
                {
                    var v = history.Pop();
                    foreach(var w in Adj[v])
                    {
                        dp[w] = Math.Max(dp[w], dp[v] + 1);
                    }
                }
                Console.WriteLine(dp.Max() + 1);
            }
            public static void F()
            {

            }
        }

        class Util
        {
            public static bool TopologicalSort2(Dictionary<int, HashSet<int>> adj, int v, bool[] done1, bool[] done2, Stack<int> history)
            {
                done1[v] = true;
                foreach(var w in adj[v])
                {
                    if (done2[w]) { continue; }
                    if (done1[w] && !done2[w])
                    {
                        return false;
                    }
                    if (!TopologicalSort2(adj, w, done1, done2, history)) { return false; }
                }
                history.Push(v);
                done2[v] = true;
                return true;
            }
            public static bool TopologicalSort(Dictionary<int, HashSet<int>> adj, int start, bool[] done1, bool[] done2, Stack<int> history)
            {
                var stack = new Stack<Tuple<int, bool>>();
                stack.Push(new Tuple<int, bool>(start, false));
                while (stack.Count > 0)
                {
                    var t = stack.Pop();
                    var v = t.Item1;
                    if (t.Item2)
                    {
                        history.Push(v);
                        done2[v] = true;
                        continue;
                    }
                    done1[v] = true;
                    stack.Push(new Tuple<int, bool>(v, true));
                    foreach (var w in adj[v])
                    {
                        if (done2[w]) { continue; }
                        if (done1[w] && !done2[w])
                        {
                            return false;
                        }
                        stack.Push(new Tuple<int, bool>(w, false));
                    }
                }
                return true;
            }
            static bool LoopDetect(Dictionary<int, HashSet<int>> adj, int v, bool[] done1, bool[] done2, Stack<int> history)
            {
                done1[v] = true;
                history.Push(v);
                foreach (var w in adj[v])
                {
                    if (done2[w]) { continue; }
                    if (done1[w] && !done2[w])
                    {
                        history.Push(w);
                        return true;
                    }
                    if (LoopDetect(adj, w, done1, done2, history))
                    {
                        return true;
                    }
                }
                history.Pop();
                done2[v] = true;
                return false;
            }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M, bool isDirectional = false)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i) { dict.Add(i, new HashSet<int>()); }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN(); dict[ab[0]].Add(ab[1]);
                    if (!isDirectional) { dict[ab[1]].Add(ab[0]); }
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}