Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- System.out.print("Введите предложение: ");
- Scanner scan = new Scanner(System.in);
- String s = scan.nextLine();
- System.out.println(s);
- //String s = "Мама мыла папу";
- int b;
- String [] strings = s.split(" ");
- //количесвто слов
- int wordsCount = strings.length;
- System.out.println(wordsCount);
- for (int i = 0; i < strings.length; i++)
- {
- b = strings[i].length();
- System.out.println(b);
- }
Add Comment
Please, Sign In to add comment