Created
July 12, 2018 14:22
-
-
Save tonkatsu7/724dd3089513708d69ba17afb234a274 to your computer and use it in GitHub Desktop.
CoderByte challenge Word Count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
class Main { | |
public static int WordCount(String str) { | |
return str.split(" ").length; | |
} | |
public static void main (String[] args) { | |
// keep this function call here | |
Scanner s = new Scanner(System.in); | |
System.out.print(WordCount(s.nextLine())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment