# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
922056 |
2024-02-04T23:51:58 Z |
jpfr12 |
Imena (COCI16_imena) |
C++17 |
|
1 ms |
348 KB |
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <math.h>
#include <cmath>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#include <fstream>
#include <bitset>
#include <iomanip>
typedef long long ll;
using namespace std;
int MOD = (int)1e9;
int MAXN = 1e6;
//classes
//global
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
//ifstream fin("teamwork.in");
//ofstream fout("teamwork.out");
//stop
int n;
cin >> n;
cin >> ws;
string str;
getline(cin, str);
str += ' ';
int num = 0;
string word = "";
set<char> Set = {'.', '!', '?'};
bool valid = true;
bool dot = false;
for(char& i: str){
if(i == ' '){
if(valid){
num++;
}
if(dot){
cout << num << '\n';
num = 0;
dot = false;
}
word = "";
valid = true;
}
else if(Set.count(i)) dot = true;
else{
int c = i-'0';
int low = i-'a';
int upper = i-'A';
if(c >= 0 && c <= 9) valid = false;
if(word.length() == 0 && low >= 0 && low < 26) valid = false;
else if(word.length() > 0 && upper >= 0 && upper < 26) valid = false;
word += i;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |