package New;
import java.util.StringTokenizer;
public class Prog10 {
static
int op = 0;
public
static void abc(String str1, String str2) {
int
count = 0, c = 0;
String
temp = null, str;
StringTokenizer
st = new StringTokenizer(str2, " ");
StringTokenizer
st1 = new StringTokenizer(str1, " ");
while
(st.hasMoreTokens()) {
str = st.nextToken();
count++;
if
(count == 2) {
temp
= str;
}
}
while
(st1.hasMoreTokens()) {
str
= st1.nextToken();
if
(str.compareTo(temp) == 0)
c++;
}
op
= c;
}
public
static void main(String[] args) {
String
str1 = "Hi this is cognizant academy";
String
str2 = "Hello this is a trainee";
abc(str1,
str2);
System.out.println(op);
}
}