五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CF265A - Colorful Stones (Simplified Edition)

2023-06-16 12:25 作者:您是打尖兒還是住店呢  | 我要投稿

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

一樣的時(shí)候就向前進(jìn)一步,不一樣的時(shí)候就原地踏步,求最后能走到哪里,

while循環(huán)即可;

下面是代碼:


CF265A - Colorful Stones (Simplified Edition)的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
邹城市| 眉山市| 桐梓县| 顺平县| 虞城县| 德昌县| 大化| 正蓝旗| 苍山县| 思茅市| 成安县| 固镇县| 沈阳市| 闸北区| 沧州市| 泰州市| 丰县| 新宾| 娱乐| 呼图壁县| 长治市| 闻喜县| 洪洞县| 东宁县| 五峰| 海门市| 永平县| 安龙县| 江安县| 琼海市| 桂东县| 平度市| 延长县| 广丰县| 都兰县| 巫山县| 全南县| 拜城县| 恩平市| 齐齐哈尔市| 基隆市|