## Searching 2

QUESTION

Manna is extremely disappointed to find out that no one in his college knows his first name. Even his classmates call him only by his last name. Frustrated, he decides to make his fellow college students know his first name by forcing them to solve this question.\n\nYou are given a long string as input in each testcase, containing any ASCII character. Your task is to find out the number of times SUVO and SUVOJIT appears in it.\n\nInput Format\nThe first line contains the number of test cases, T. Next, T lines follow each containing a long string S.\n \nOutput Format\nFor each long string S, display the no. of times SUVO and SUVOJIT appears in it.

``````import java.util.*;

class TestClass {
public static void main(String args[] ) throws Exception {
Scanner scan = new Scanner(System.in);
int testCase = scan.nextInt();
while(testCase--!=0){
char[] arr = scan.next().toCharArray();
int suvo = 0;
int jit = 0;
for(int i = 0;i<arr.length-3;i++){
if(arr[i] == 'S' && arr[i+1] == 'U' && arr[i+2] == 'V' && arr[i+3] == 'O'){
suvo++;
if(i<arr.length-6){
if(arr[i+4] == 'J' && arr[i+5] == 'I' && arr[i+6] == 'T'){
jit++;
suvo--;
}
}
}
}
System.out.println("SUVO = " + suvo + ", SUVOJIT = "+jit);
}
}
}``````