/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String str
= "java cSharp pYthOn"; System.
out.
println(toTitledCase
(str
)); }
String[] words
= str.
split("\\s"); StringBuilder sb = new StringBuilder();
for(int i = 0; i < words.length; i++){
sb.append(words[i].substring(0, 1).toUpperCase() + words[i].substring(1).toLowerCase());
sb.append(" ");
}
return sb.toString();
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZyBzdHIgPSAiamF2YSBjU2hhcnAgcFl0aE9uIjsKCQlTeXN0ZW0ub3V0LnByaW50bG4odG9UaXRsZWRDYXNlKHN0cikpOwoJfQoJCglwdWJsaWMgc3RhdGljIFN0cmluZyB0b1RpdGxlZENhc2UoU3RyaW5nIHN0cil7CgkJCgkJU3RyaW5nW10gd29yZHMgPSBzdHIuc3BsaXQoIlxccyIpOwoJCVN0cmluZ0J1aWxkZXIgc2IgPSBuZXcgU3RyaW5nQnVpbGRlcigpOwoJCQoJCWZvcihpbnQgaSA9IDA7IGkgPCB3b3Jkcy5sZW5ndGg7IGkrKyl7CgkJCXNiLmFwcGVuZCh3b3Jkc1tpXS5zdWJzdHJpbmcoMCwgMSkudG9VcHBlckNhc2UoKSArIHdvcmRzW2ldLnN1YnN0cmluZygxKS50b0xvd2VyQ2FzZSgpKTsKCQkJc2IuYXBwZW5kKCIgIik7CgkJfQoJCQoJCXJldHVybiBzYi50b1N0cmluZygpOwoJfQoJCn0=