Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.forlornly;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class MinTwoVowels {
- /**
- * @param args
- */
- public static void main(String[] args) {
- try {
- Scanner scanner = new Scanner(new File("input.txt"));
- scanner.useDelimiter("[ ,\n\r]");
- Pattern pattern = Pattern.compile("[aeiou]{1}");
- while (scanner.hasNext()) {
- String s = scanner.next();
- int count = 0;
- Matcher matcher = pattern.matcher(s);
- while (matcher.find()) {
- count++;
- }
- if (count >= 2) {
- System.out.println("Cuvant cu " + count + " vocale (mai mult de doua inclusiv): " + s);
- }
- }
- scanner.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment