#include main() { int count[26]; int i; for(i = 0; i < 26; i++) count[i] = 0; ifstream in("day2a.dat", ios::nocreate); if(in == NULL) { cerr << "Error no input file\n"; return 1; } int c; while(!in.fail() && (c = in.get()) != '\n') if(c >= 'a' && c <= 'z') count[c - 'a']++; // If a lowercase letter, increase the count for that letter int max = 0; for(i = 1; i < 26; i++) if(count[i] > count[max]) max =i; ofstream out("day2a.sol"); out << count[max] << endl; for(i = 0; i < 26; i++) if(count[i] == count[max]) out << char('a'+i); out << endl; return 0; }