|
|
вернуться в форумHelp! Why do i get Runtime error on test 1? Here is my code, what's the problem? #include <algorithm> #include <iostream> #include <vector> #include <sstream> #include <string> #include <cstdlib> #include <cstdio> #include <iomanip> using namespace std; int main(){ int count[26]; int max = 0; char answer = '-'; for (char p = 'a'; p < char('z') + 1; p++) { count[p] = 0; } char c; while (cin.get(c)) { count[c]++; } for (char p = 'a'; p < char('z') + 1; p++) { if (count[p] > max){ max = count[p]; answer = p; } } cout << answer; } |
|
|