Submission #397510

#TimeUsernameProblemLanguageResultExecution timeMemory
397510AlmaImena (COCI16_imena)C++17
50 / 50
1 ms332 KiB
#include <bits/stdc++.h> using namespace std; bool name (string & s, int m) { if ('A' <= s[0] && s[0] <= 'Z') {} else return false; for (int i = 1; i < m; i++) { if ('a' <= s[i] && s[i] <= 'z') continue; else if ((s[i] == '.' || s[i] == '?') || s[i] == '!') continue; else return false; } return true; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, sentence = 1, names = 0; cin >> n; string s; while (cin >> s) { if (sentence > n) break; int m = (int)s.size(); if (name(s, m)) names++; if ((s[m-1] == '.' || s[m-1] == '?') || s[m-1] == '!') { cout << names << '\n'; names = 0; sentence++; } } return 0; }

Compilation message (stderr)

imena.cpp: In function 'int main()':
imena.cpp:17:12: warning: unused variable 'm' [-Wunused-variable]
   17 |     int n, m, sentence = 1, names = 0;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...