-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram70.java
38 lines (33 loc) · 877 Bytes
/
Program70.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Program 70
13/8/24 */
import java.util.Scanner;
public class Latin {
String name;
Latin() {
name = "";
}
void input(String n) {
name = n;
n += " ";
String w = "";
for (int i = 0; i < n.length(); i++) {
if (n.charAt(i) == ' ') {
if ("aeiou".indexOf(w.charAt(0)) != -1) {
System.out.print(w + "yay ");
} else {
System.out.print(w.substring(1) + w.charAt(0) + "ay ");
}
w = "";
} else {
w += n.charAt(i);
}
}
System.out.println();
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
Latin l = new Latin();
System.out.print("Enter sentence: ");
l.input(sc.nextLine());
}
}