Submission #88450

# Submission time Handle Problem Language Result Execution time Memory
88450 2018-12-06T01:28:43 Z xiaowuc1 Imena (COCI16_imena) C++14
10 / 50
4 ms 784 KB
#include <bits/stdc++.h>

using namespace std;

void solve() {
  string s;
  int ret = 0;
  while(true) {
    s = "";
    cin >> s;
    if(s.size() == 0) break;
    bool bad = false;
    if(s[0] < 'A' || s[0] < 'Z') bad = true;
    for(int i = 1; i < s.size(); i++) {
      bool letter = s[i] >= 'A' && s[i] <= 'Z';
      letter |= s[i] >= 'a' && s[i] <= 'z';
      bad |= !letter;
    }
    {
      bool perm = false;
      perm |= s[s.size()-1] >= 'A' && s[s.size()-1] <= 'Z';
      perm |= s[s.size()-1] >= 'a' && s[s.size()-1] <= 'z';
      perm |= s[s.size()-1] == '!';
      perm |= s[s.size()-1] == '?';
      perm |= s[s.size()-1] == '.';
      bad |= !perm;
    }
    if(!bad) ret++;
    if(s[s.size()-1] == '.' || s[s.size()-1] == '!' || s[s.size()-1] == '?') {
      cout << ret << endl;
      ret = 0;
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
}

Compilation message

imena.cpp: In function 'void solve()':
imena.cpp:14:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < s.size(); i++) {
                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 512 KB Output isn't correct
3 Incorrect 2 ms 512 KB Output isn't correct
4 Incorrect 2 ms 512 KB Output isn't correct
5 Correct 2 ms 572 KB Output is correct
6 Incorrect 2 ms 572 KB Output isn't correct
7 Incorrect 2 ms 572 KB Output isn't correct
8 Correct 2 ms 652 KB Output is correct
9 Incorrect 4 ms 784 KB Output isn't correct
10 Incorrect 2 ms 784 KB Output isn't correct