fork(1) download
  1. package readability;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7.  
  8. Scanner sc = new Scanner(System.in);
  9. String word = sc.nextLine();
  10. String[] nums = word.split(" ");
  11. //System.out.println(nums.length); // total words
  12. int allWords = nums.length;
  13.  
  14. int sentences = word.split("[!.,]+[//?]*").length; //number of sentences
  15.  
  16. //System.out.println(sentences);
  17.  
  18. if (allWords/sentences <= 10) {
  19. System.out.println("EASY");
  20. }
  21. else if (allWords/sentences > 10) {
  22. System.out.println("HARD");
  23. }
  24. sc.close();
  25. }
  26. } /* примеры ниже не работают правильно где допустил ошибку
  27.  This text is simple to read! It has on average less than 10 words per sentence.
  28.  This text is hard to read. It contains a lot of sentenses as well as a lot of words in each sentence
  29.   > 12, 12 13 14 14 14, 12 21 23 89! 75 12, 134 241 123, 123 123 123, 123 123 123? 123, 123 123 123 23 123 213 123 123 123.
  30. */
Runtime error #stdin #stdout #stderr 0.08s 33908KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: Could not find or load main class Main
Caused by: java.lang.NoClassDefFoundError: readability/Main (wrong name: Main)