Check if a string can be split into two substrings with equal number of vowels

  
import java.io.*;
  
class GFG {
  
    
    
    public static boolean isVowel(char ch)
    {
        
        if (ch == ‘a’ || ch == ‘e’ || ch == ‘i’
            || ch == ‘o’ || ch == ‘u’)
            return true;
  
        
        if (ch == ‘A’ || ch == ‘E’ || ch == ‘I’
            || ch == ‘O’ || ch == ‘U’)
            return true;
  
        
        return false;
    }
  
    
    
    
    public static String
    containsEqualStrings(String S)
    {
  
        
        
        int totalVowels = 0;
  
        
        for (int i = 0;
             i < S.length(); i++) {                             if (isVowel(S.charAt(i)))                 totalVowels++;         }                              int vowelsTillNow = 0;                     for (int i = 0;              i < S.length(); i++) {                             if (isVowel(S.charAt(i))) {                 vowelsTillNow++;                 totalVowels--;                                                      if (vowelsTillNow                     == totalVowels) {                        return "Yes";                 }             }         }                     return "No";     }             public static void main(String[] args)     {         String S = "geeks";         System.out.println(             containsEqualStrings(S));     } }