Codeforces Round 162 (Div. 2)
A
Colorful Stones (Simplified Edition)
Codeforces
800
原题
←B →
翻译中…

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.

翻译中…

样例

Input #1
RGB
RRR
Output #1
2
InputCopy OutputCopy
Input #2
RRRBGBRBBB
BBBRR
Output #2
3
InputCopy OutputCopy
Input #3
BRRBGBRGRBGRGRRGGBGBGBRGBRGRGGGRBRRRBRBBBGRRRGGBBB
BBRBGGRGRGBBBRBGRBRBBBBRBRRRBGBBGBBRRBBGGRBRRBRGRB
Output #3
15
InputCopy OutputCopy
题目信息
题号
265A
时间限制
2 s
内存限制
256 MB
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。