Skip to content

HarshSDE0/string-check-for-vowel-or-consonant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

//{ Driver Code Starts //Initial Template for Java

import java.util.; import java.lang.; import java.io.*; class GFG {

public static void main (String[] args)
{
    //taking input using class Scanner
	 Scanner sc = new Scanner(System.in);
	 
	 //taking total count of all testcases
	 int t = sc.nextInt();
	 sc.nextLine();
	 boolean flag = false;
	 while(t-- > 0){
	  
	  //taking the input String
	  String s=sc.nextLine();
	  
	  //Creating an object of class Geeks
	  Geeks obj=new Geeks();
	  
	  //calling the checkString
	  //method of class Geeks
	  obj.checkString(s);
	   
	 }
}

} // } Driver Code Ends

//User function Template for Java

class Geeks{

static void checkString(String s)
{
    int v=0;
    int c=0;
    char arr[]=new char[s.length()];
    for(int i =0; i<s.length();i++){
        arr[i] = s.charAt(i);
    }
    for(int i = 0; i<s.length() ;i++){
        if(arr[i]=='a'||arr[i]=='e'||arr[i]=='i'||arr[i]=='o'||arr[i]=='u'||arr[i]=='A'||arr[i]=='E'||arr[i]=='I'||arr[i]=='O'||
        arr[i]=='U'){
            v++;
        }
        else if(arr[i]==' '){
            continue;
        }
        else{
            c++;
        }
    }
    //Your code here
    
    if(v>c)
    System.out.print("Yes");
    else if(c>v)
    System.out.print("No");
    else
   System.out.print("Same");
    
    System.out.println();
}

}

//Position this line where user code will be pasted.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published