import java.util.HashSet;
public class Test{
public static void main(String[] args){
String str="How are you! I want tell you!";
System.out.println(countDifferentWords(str));
}
public static int countDifferentWords(String str){
String[] words=str.split("\\s+");
HashSet<String> hs=new HashSet<>();
for(String word:words){
hs.add(word);
}
return hs.size();
}
}