Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Wally{
- /**
- * Laboratório de Programação 2 - Lab 1
- *
- * @author Fagner Henrique dos Santos Lima - 117110092
- */
- public static void main(String[] args){
- Scanner input = new Scanner(System.in);
- while(true){
- String result = "?";
- String nomes = input.nextLine();
- if(nomes.equals("wally")){
- break;
- }else{
- String[] nome = nomes.split(" ");
- for(int i = 0; i < nome.length; i++){
- if(nome[i].length() == 5){
- result = nome[i];
- }
- }
- }
- System.out.println(result);
- }
- }
- }
Add Comment
Please, Sign In to add comment