Untitled

 avatar
unknown
plain_text
3 years ago
680 B
5
Indexable
#include <fstream>
#include <cstring>

using namespace std;

char s[255], inceput[15]=":;>8", sfarsit[15]="()[]DPOX3";
int cnt, i;
   
int main(){
    ifstream cin("smiley.in"); 
    ofstream cout("smiley.out"); 
    
    while(cin.getline(s, 255)){
        for(int i=0; s[i]; i++){
            if(strchr(inceput, s[i])){
                i++;
                while(s[i]=='-'){
                    i++;
                }
                if(s[i] && strchr(sfarsit, s[i])){ 
                    cnt++;
                }
                else{
                    i--;
                }
            }
        }
    }
    
    cout<<cnt;

    return 0;
}
Editor is loading...