Guest User

Untitled

a guest
Oct 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Wally{
  4.  
  5. /**
  6. * Laboratório de Programação 2 - Lab 1
  7. *
  8. * @author Fagner Henrique dos Santos Lima - 117110092
  9. */
  10.  
  11. public static void main(String[] args){
  12.  
  13. Scanner input = new Scanner(System.in);
  14.  
  15. while(true){
  16.  
  17. String result = "?";
  18. String nomes = input.nextLine();
  19. if(nomes.equals("wally")){
  20. break;
  21. }else{
  22. String[] nome = nomes.split(" ");
  23. for(int i = 0; i < nome.length; i++){
  24. if(nome[i].length() == 5){
  25. result = nome[i];
  26. }
  27. }
  28. }
  29.  
  30. System.out.println(result);
  31. }
  32.  
  33. }
  34.  
  35.  
  36.  
  37. }
Add Comment
Please, Sign In to add comment