Witam. Jestem tu nowy i mam problem z zadaniem Zliczacz liter. Kod u mnie dziala prawidlowo, jednak SPOJ go nie zalicza. Moglby mi ktos pomoc?
include
include
using namespace std;
const int AlphSize = 52;
int main()
{
string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int count[AlphSize] = { 0 };
int iterations;
string sentences;
cin >> iterations;
cin.get();
for (int i = 0; i < iterations; i++) {
getline(cin, sentences);
for (int i = 0; i < sentences.size(); i++) {
for (int j = 0; j < alphabet.size(); j++) {
if (sentences[i] == alphabet[j]) {
count[j] += 1;
}
}
}
}
for (int i = 0; i < AlphSize; i++) {
if (!(count[i] == 0)) {
cout << alphabet[i] << ": " << count[i] << endl;
}
}
cin.get();
return 0;
}