File size: 744 Bytes
c574d3a |
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 |
import java.util.Scanner;
/**
* Word case fixer program
*
* Fix all the case in the given word.
*
* If the word contains a majority of uppercase characters, it will be fixed
* into all uppercase word.
*
* E.g: TeS -> TES
*
* If the word contains a majority of lowercase characters, it will be fixed
* into all lowercase word.
*
* E.g: Tes -> tes
*/
public class WordCaseFixer {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
if (str.chars().filter(c -> c < 97).count() * 2 > str.length()) {
System.out.print(str.toUpperCase());
} else {
System.out.println(str.toLowerCase());
}
sc.close();
}
}
|