import java.util.*;
import java.io.*;

public class Main implements Runnable {

	Scanner in;
	PrintWriter out;

	boolean check(StringBuilder sb, int start, int len, String pattern) {
		int pos = start;
		int end = start + len - 1;
		int patternPos = 0;
		while (true) {
			while (patternPos < pattern.length()
					&& pattern.charAt(patternPos) == '*') {
				patternPos++;
			}
			if (patternPos == pattern.length()) {
				if (pos <= end+1) {
					return true;
				} else {
					return false;
				}
			}
			char expected = pattern.charAt(patternPos);
			while (true) {
				if (pos > end) {
					return false;
				}
				if (sb.charAt(pos) != expected) {
					pos++;
				} else {
					pos++;
					break;
				}
			}
			patternPos++;
		}
	}

	void solve() {
		String template = in.nextLine();
		String st = in.nextLine();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < st.length(); i++) {
			sb.append(st.charAt(i));
		}
		for (int i = 0; i < st.length(); i++) {
			sb.append(st.charAt(i));
		}
		int cnt = 0;
		for (int i = 0; i < st.length(); i++) {
			if (check(sb, i, st.length(), template)) {
				cnt++;
			}
		}
		out.println(cnt);
	}

	public void run() {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		try {
			solve();
		} finally {
			out.close();
		}
	}

	public static void main(String args[]) {
		new Main().run();
	}

}
