31 lines
445 B
C
31 lines
445 B
C
|
#include <stdio.h>
|
||
|
|
||
|
#define MAX 48
|
||
|
|
||
|
int getScore(char *s);
|
||
|
|
||
|
int main() {
|
||
|
char input[MAX];
|
||
|
int score;
|
||
|
|
||
|
scanf("%s", input);
|
||
|
score = getScore(input);
|
||
|
printf("%d\n", score);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/* 请在这里填写答案 */
|
||
|
int getScore(char *s) {
|
||
|
int score = 0;
|
||
|
while (*s != '\0') {
|
||
|
if (*s == 'W') { // Win
|
||
|
score += 3;
|
||
|
} else if (*s == 'D') { // Draw
|
||
|
score += 1;
|
||
|
} // If lost, the score is unchanged
|
||
|
s++;
|
||
|
}
|
||
|
return score;
|
||
|
}
|