#include #include #include using namespace std; const char Unknow[] = {"Unknown letter grade in input"}; int match(char ch) { switch (ch) { case 'A': return 4; case 'B': return 3; case 'C': return 2; case 'D': return 1; case 'F': return 0; } return -1; } int main() { string input; while (getline(cin, input)) { int length = input.length(); char *charInput = (char *) input.data(); int score = 0, total = 0, num = 0; bool flag = true; for (int i = 0; i < length; i++) { if (charInput[i] < 'A' || charInput[i] > 'Z') { continue; } score = match(charInput[i]); if (score < 0) { flag = false; cout << Unknow << endl; break; } total += score; num++; } if (flag) { cout << fixed << setprecision(2) << float(total) / float(num) << endl; } } return 0; }