JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Use this syntax to detect input
//Changes each word of user input to an array element
//Author : Rifat Bin Salam
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
String word;
Scanner input=new Scanner(System.in);
word=input.nextLine().toLowerCase();
String all[]=word.split(" ");
//Changed each words of input to an array element
for(int i=0;i<(all.length);i++){
switch(all[i]){
case"hi":
System.out.println("detected");
break;
}
}
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run