I need to count the number of words and I am assuming the correct way to do it is by calculating the number of times that the previous character in a string is not a letter
Use just like this
String s = "I am Juyel Rana, from Bangladesh"; int count = s.split(" ").length;