Submission #293948

#TimeUsernameProblemLanguageResultExecution timeMemory
2939487_7_7Imena (COCI16_imena)C++17
50 / 50
1 ms384 KiB
#include <bits/stdc++.h> using namespace std; int n; bool good(string s){ if(s.back() == '.') s.pop_back(); if(s.back() == '?') s.pop_back(); if(s.back() == '!') s.pop_back(); if('A' <= s[0] && s[0] <= 'Z'){ for(int i = 1; i < (int)s.size(); i ++){ if('a' <= s[i] && s[i] <= 'z') continue; return false; } return true; } return false; } int main() { ios_base::sync_with_stdio(false); cin >> n; vector<int> res; for(int i = 1; i <= n; i ++){ string s; int cnt = 0; while(true){ cin >> s; cnt += (good(s) == true); if(s.back() == '.' || s.back() == '?' || s.back() == '!') break; } res.push_back(cnt); } for(auto x: res) cout << x << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...