|
|
вернуться в форумI don't know Why my program WA on it !! Can't anyone give Inputs. If the inputs is too big to be posted. You may test my program if you like. I just hate WA on such easy problem very much....very much. #include <iostream> #include <strstream> #include <string> using namespace std; const int MAX_LEN = 10000; char lines[MAX_LEN+2]; void Solve() { istrstream istr(lines); string marks; int wrongs = 0; while ( getline(istr, marks, '*') ) { string word; istrstream istr2(marks.c_str()); istr2 >> word; if (word.size() == 0) continue; if (word[0] < 'A' || word[0] > 'Z') { ++wrongs; } while (istr2 >> word) { for (int i = 1; i < word.size(); ++i) { if (word[i] >= 'A' && word[i] <= 'Z') { ++wrongs; } } } } cout << wrongs << endl; } int main() { char ch; int idx = 0; while ( cin.get(ch) ) { if (ch == '.' || ch == '?' || ch == '!') { lines[idx] = '*'; } else if (ch == ',' || ch == ';' || ch == ':' || ch == '-' || ch == '\n') { lines[idx] = ' '; } else { lines[idx] = ch; } ++idx; } lines[idx] = '*'; lines[idx+1] = '\0'; // Solve(); // return 0; } |
|
|