#include<stdio.h> #include<string.h> int main() { char a[51],b[51]; int i,n,t=1; scanf("%s %s",a,b); n=strlen(b); for(i=0;i<n;i++) { if(a[t-1]==b[i])t++; } printf("%d",t); return 0; }
http://codeforces.com/contest/265/problem/A