In this Kata, you will be given a string that may have mixed uppercase and lowercase letters and your task is to convert that string to either lowercase only or uppercase only based on:

For example:

solve("coDe") = "code". Lowercase characters > uppercase. Change only the "D" to lowercase.
solve("CODe") = "CODE". Uppercase characters > lowecase. Change only the "e" to uppercase.
solve("coDE") = "code". Upper == lowercase. Change all to lowercase.

More examples in test cases. Good luck!

String solve(String s) {
  int stringLength = s.length;
  int countUpper = 0;
  for (int i = 0; i < stringLength; i++) {
    if(s[i].toUpperCase() == s[i]) {
      countUpper++;
    }
  }
  
  return stringLength / 2 < countUpper ? s.toUpperCase() : s.toLowerCase();
  
}
String solve(String s) => RegExp('[A-Z]').allMatches(s).length > RegExp('[a-z]').allMatches(s).length ? s.toUpperCase() : s.toLowerCase();