# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
883656 |
2023-12-05T15:58:38 Z |
vjudge1 |
Imena (COCI16_imena) |
C++17 |
|
0 ms |
348 KB |
#ifndef Local
#pragma GCC optimize("O3,unroll-loops")
const int lim=2e5+100;
#else
const int lim=1e3+100;
#endif
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
const int mod=1e9+7;
using pii=pair<int,int>;
inline void solve(){
int n;
cin>>n;
int curcount=0;
while(n){
string s;
cin>>s;
if('A'<=s[0]&&s[0]<='Z'){
for(int j=1;j<s.size()-1;j++){
if('a'>s[j]||s[j]>'z'){
goto isnot;
}
}
if((s.size()==1)||
('a'<=s.back()&&s.back()<='z')||
s.back()=='.'||s.back()=='!'||s.back()=='?')
curcount++;
}
isnot:;
if(s.back()=='.'||s.back()=='!'||s.back()=='?'){
cout<<curcount<<"\n";
curcount=0;
n--;
}
}
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
#ifdef Local
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#else
//freopen("grass.in","r",stdin);
//freopen("grass.out","w",stdout);
#endif
int t=1;
//cin>>t;
while (t--)
{
solve();
}
}
Compilation message
imena.cpp: In function 'void solve()':
imena.cpp:25:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for(int j=1;j<s.size()-1;j++){
| ~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |