#include #include unsigned int Amount[37]; unsigned int Length[37]; int main() { int i, c, max_amount, K_with_max_amount; for (i = 0; i < 37; i++) { Amount[i] = Length[i] = 0; } while (1) { c = getchar(); if (isspace(c) || feof(stdin)) { for (i = 2; i <= 36; i++) { if (Length[i]) { Amount[i]++; Length[i] = 0; } } if (feof(stdin)) { break; } } else if (isdigit(c)) { for (i = 2; i <= c-'0'; i++) { if (Length[i]) { Amount[i]++; Length[i] = 0; } } for (; i <= 36; i++) { Length[i]++; } } else if (isupper(c)) { for (i = 2; i <= c-'A'+10; i++) { if (Length[i]) { Amount[i]++; Length[i] = 0; } } for (; i <= 36; i++) { Length[i]++; } } } max_amount = 0; for (i = 2; i <= 36; i++) { if (max_amount < Amount[i]) { K_with_max_amount = i; max_amount = Amount[i]; } } printf("%d %d\n", K_with_max_amount, max_amount); return 0; }