import java.util.*;
public class Main {
public static boolean isHw(String a) {
char[] arr = a.toCharArray();
int i = 0, j = arr.length - 1;
while(i < j) {
if(arr[i] != arr[j])
return false;
i++;
j--;
}
return true;
}
public static void solve(String A, String B) {
int cnt = 0;
String ans = A + B;
if(isHw(ans)) {
cnt++;
}
ans = B + A;
if(isHw(ans)) {
cnt++;
}
for(int i = 1; i < A.length(); i++) {
ans = A.substring(0, i) + B + A.substring(i, A.length());
if(isHw(ans)) {
cnt++;
}
}
System.out.println(cnt);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
String A = sc.next();
String B = sc.next();
solve(A, B);
}
}
}