import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	}
} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	} main {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	} BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in)); insBR new BufferedReader(new InputStreamReader(System.in)) ArrayList<String> list = new ArrayList<String>(); list new ArrayList<String>() while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		} true {
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		} try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			} catch(IOException e){
				System.out.println(e);
			} IOException e {
				System.out.println(e);
			} System.out.println(e) System.out.println System.out System System.out e {

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			} String strScan = insBR.readLine(); strScan insBR.readLine() insBR.readLine insBR if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				} "END_OF_TEXT".equals(strScan) "END_OF_TEXT".equals "END_OF_TEXT" strScan {
					break;
				} break; {
					list.add(strScan);
				} list.add(strScan) list.add list strScan String strFindLine = null; strFindLine null String strLine = null; strLine null int intCount = 0; intCount 0 for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		} int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		} {
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		} if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			} i == 0 i 0 {
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			} strFindLine = list.get(i) strFindLine list.get(i) list.get list i strFindLine = strFindLine.toLowerCase() strFindLine strFindLine.toLowerCase() strFindLine.toLowerCase strFindLine {
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			} strLine = list.get(i) strLine list.get(i) list.get list i strLine = strLine.toLowerCase() strLine strLine.toLowerCase() strLine.toLowerCase strLine String[] ary = strLine.split(" "); ary strLine.split(" ") strLine.split strLine " " for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				} int j = 0; int j = 0; j 0 j < ary.length j ary.length ary ary.length j++ j++ j {
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				} {
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				} if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					} ary[j].length() == strFindLine.length() ary[j].length() ary[j].length ary[j] ary j strFindLine.length() strFindLine.length strFindLine {

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					} int intJudge = ary[j].indexOf(strFindLine); intJudge ary[j].indexOf(strFindLine) ary[j].indexOf ary[j] ary j strFindLine if(-1 < intJudge){
							intCount++;
						} -1 < intJudge -1 1 intJudge {
							intCount++;
						} intCount++ intCount System.out.println( intCount) System.out.println System.out System System.out intCount String[] args args public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????

		BufferedReader insBR = new BufferedReader(new InputStreamReader(System.in));

		ArrayList<String> list = new ArrayList<String>();

		while(true){
			try{

				String strScan = insBR.readLine();


				if("END_OF_TEXT".equals(strScan)){
					break;
				}else{
					list.add(strScan);
				}


			}catch(IOException e){
				System.out.println(e);
			}

		}


		//????´¢?????????????????????????????°
		String strFindLine = null;
		//????????\???????????????????????°
		String strLine = null;

		//????´¢?????????????????????????????????????????°
		int intCount = 0;
		for(int i = 0; i < list.size(); i++){
			//????´¢??????????????????
			if(i == 0){
				//list???0??????
				strFindLine = list.get(i);
				strFindLine = strFindLine.toLowerCase();
			}else{
				//list1????????\???
				strLine = list.get(i);
				strLine = strLine.toLowerCase();
				//1??????????????§??????????????????????´?
				String[] ary = strLine.split(" ");
				//1????????????????????¨????????´????????????????????????
				for(int j = 0; j < ary.length; j++){
					//ary[]???????????¨findLine???????????°???????????????????´¢
					if(ary[j].length() == strFindLine.length()){

						int intJudge = ary[j].indexOf(strFindLine);

						if(-1 < intJudge){
							intCount++;
						}
					}
				}

			}
		}
		System.out.println( intCount);
	}
}