How to decode a code that modifies the vowels

0

I'm trying to create a code that modifies the vowels. As an example of an entry would be:

2n1v5rs0 5 t2d0 0 q25 5x1st5 f1s1c4m5nt5, 1ncl21nd0 t0d0s 0s ...

and the output would be:

  

universe and everything that exists physically, including all ...

I thought about starting the code with something like this:

Scanner reader = new Scanner(System.in);

if()
    char a = reader.next().charAt(4);
    char e = reader.next().charAt(5);
    char i = reader.next().charAt(1);
    char o = reader.next().charAt(0);
    char u = reader.next().charAt(2);
else 

But I do not know what to put in if and else .

    
asked by anonymous 12.04.2017 / 03:26

1 answer

0

Use method public String replace(char oldChar, char newChar)

import java.io.*;
public class Test {

 public static void main(String args[]) {
   String Str = new String("2n1v5rs0 5 t2d0 0 q25 5x1st5 f1s1c4m5nt5, 1ncl21nd0 t0d0s 0s");

   Str = Str.replace("1", "i");
   Str = Str.replace("2", "u");
   Str = Str.replace("0", "o");
   Str = Str.replace("4", "a");
   Str = Str.replace("5", "e");
   System.out.print(Str);
 }
}
    
12.04.2017 / 03:35