# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23067 | model_code | Imena (COCI16_imena) | C++11 | 0 ms | 2020 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <string>
using namespace std;
bool jeInterZnak( char c ) {
return c == '.' || c == '?' || c == '!';
}
bool imaInterZnakNaZadnjemMjestu( string rijec ) {
return jeInterZnak( rijec[ rijec.size()-1 ] );
}
bool jeIme( string rijec ) {
// ako prvo slovo nije veliko slovo engleske abecede
if( rijec[ 0 ] < 'A' || rijec[ 0 ] > 'Z' ) {
return false;
}
for( int i = 1; i < rijec.size(); ++i ) {
if( (rijec[ i ] < 'a' || rijec[ i ] > 'z') && jeInterZnak(rijec[ i ]) == false ) {
return false;
}
}
return true;
}
int main () {
int n;
cin >> n;
for( int i = 0; i < n; ++i ) {
int cnt = 0;
string rijec;
do {
cin >> rijec;
if( jeIme( rijec ) ) {
++cnt;
}
} while( imaInterZnakNaZadnjemMjestu( rijec ) == false );
cout << cnt << endl;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |