Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class rev{
- static String newrds = "";
- static String wrds;
- public static void main(){
- rev ob = new rev();
- ob.acceptword();
- ob.freqvowcont();
- ob.nextVowel();
- ob.disp();
- }
- void acceptword(){
- Scanner sc = new Scanner(System.in);
- wrds = sc.nextLine();
- wrds = wrds.toUpperCase();
- }
- void freqvowcont(){
- int c = 0;
- for(int i =0; i< wrds.length();i++){
- char ch = wrds.charAt(i);
- if(ch =='A'||ch =='E'||ch =='O'||ch =='I'||ch =='U'){
- c++;
- }
- }
- System.out.println("vowels:"+c+" consonants"+(wrds.length()-c));
- }
- void nextVowel(){
- int len = wrds.length();
- for(int i =0;i<len;i++){
- char ch = wrds.charAt(i);
- if(ch =='A'||ch =='E'||ch =='O'||ch =='I'||ch =='U'){
- newrds = ch+newrds;
- }
- else{
- newrds = newrds+ch;
- }
- }
- }
- void disp(){
- System.out.println(newrds);
- newrds ="";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment