There is a sequence of colorful stones. The color of each stone is one of red, green, or blue. You are given a string s. The i-th (1-based) character of s represents the color of the i-th stone. If the character is "R", "G", or "B", the color of the corresponding stone is red, green, or blue, respectively.

Initially Squirrel Liss is standing on the first stone. You perform instructions one or more times.

Each instruction is one of the three types: "RED", "GREEN", or "BLUE". After an instruction c, if Liss is standing on a stone whose colors is c, Liss will move one stone forward, else she will not move.

You are given a string t. The number of instructions is equal to the length of t, and the i-th character of t represents the i-th instruction.

Calculate the final position of Liss (the number of the stone she is going to stand on in the end) after performing all the instructions, and print its 1-based position. It is guaranteed that Liss don't move out of the sequence.

Input

The input contains two lines. The first line contains the string s (1 ≤ |s| ≤ 50). The second line contains the string t (1 ≤ |t| ≤ 50). The characters of each string will be one of "R", "G", or "B". It is guaranteed that Liss don't move out of the sequence.

Output

Print the final 1-based position of Liss in a single line.

Examples

Input

RGB
RRR


Output

2


Input

RRRBGBRBBB
BBBRR


Output

3


Input

BRRBGBRGRBGRGRRGGBGBGBRGBRGRGGGRBRRRBRBBBGRRRGGBBB
BBRBGGRGRGBBBRBGRBRBBBBRBRRRBGBBGBBRRBBGGRBRRBRGRB


Output

15
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Reader.init(System.in);
        String s = Reader.next() ; 
        String t = Reader.next() ; 
        int pos = 0 ; 
        for (int i=0 ; i<t.length() ; i++) {
            if (t.charAt(i)==s.charAt(pos))
                pos++;            
        }
        System.out.println(pos+1);        
    }

    public static void fill(int[] a) throws Exception {
        for (int i = 0; i < a.length; i++) {
            a[i] = Reader.nextInt();
        }
    }
 static void s(int[] cc) {
        for (int e = 0; e < cc.length; e++) {
            for (int q = e + 1; q < cc.length; q++) {
                if (cc[e] < cc[q]) {
                    int g = cc[e];
                    cc[e] = cc[q];
                    cc[q] = g;
                }
            }
        }
      
    }
    static boolean isPalindrome(String s) {
        int n = s.length();
        for (int i = 0; i < (n / 2) + 1; ++i) {
            if (s.charAt(i) != s.charAt(n - i - 1)) {
                return false;
            }
        }

        return true;
    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

}
