import java.util.Scanner;
public class BF {
public static void main(String[] args) {
String S = new String(); //主串S
String T = new String(); //模式串T
int pos;
int result;
Scanner console = new Scanner(System.in);
S = console.nextLine();
T = console.nextLine();
pos = console.nextInt();
System.out.printf("%s\n", S);
System.out.printf("%s\n", T);
System.out.printf("%d\n", pos);
result = Index(S, T, pos);
System.out.printf("%d\n", result);
}
private static int Index(String S, String T, int pos){
int i = pos;
int j = 1;
while(i <= S.length() && j <= T.length()){
if(S.charAt(i) == T.charAt(j)){ //char.At方法是取出字符串中的字符
i++;
j++;
}
else{
i = i-j+2;
j = 1;
}
}
if(j > T.length()){
return i-T.length();
}
else{
return 0;
}
}
}
