import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); String target = sc.next(); int m = sc.nextInt(); int count = 0; for (int i = 0; i < m; i++) { String test = sc.next(); int idx = 0; while ((idx = target.indexOf(test, idx)) != -1) { idx++; count++; } } System.out.println(count); } }