Java Cara Menetapkan Surat Alfabet A Skor
'a' = 97;
'z' = 122;
'A' = 65;
'Z' = 90;
score += strArr[i].charAt(j) - 'a' + 1;
Inna Kim
'a' = 97;
'z' = 122;
'A' = 65;
'Z' = 90;
score += strArr[i].charAt(j) - 'a' + 1;
int score = 0;
int maxScore = 0;
int count = 0;
String[] strArr = s.split(" ");
for (int i = 0; i < strArr.length; i++) {
strArr[i] = strArr[i].toLowerCase();
for (int j = 0; j < strArr[i].length(); j++) {
if (j == 0) {
score = 0;
}
score += strArr[i].charAt(j) - 'a' + 1;
}
if (score > maxScore) {
maxScore = score;
count = i;
}
}
return strArr[count];