Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Laborator3
  4. {
  5. public static void main(String[] args)
  6. {
  7. Scanner kbd = new Scanner(System.in);
  8. String cuvant = kbd.next();
  9. ArrayList<String> lista = new ArrayList<String>();
  10.  
  11. lista.add(cuvant);
  12. int lungime = cuvant.length();
  13.  
  14. while (lungime < 10)
  15. {
  16. cuvant = kbd.next();
  17. lista.add(cuvant);
  18. lungime = cuvant.length();
  19. }
  20.  
  21. int nr = 0;
  22.  
  23. for (int i = 0; i < lista.size(); i++)
  24. {
  25. String buffer = lista.get(i);
  26.  
  27. if (buffer.length() % 2 == 0)
  28. {
  29. nr++;
  30. }
  31. }
  32.  
  33. System.out.println("Sunt " + nr + " cuvinte pare");
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement