Untitled

 avatar
unknown
plain_text
2 years ago
672 B
3
Indexable
#include <fstream>
#include <cstring>
#include <string>

using namespace std;

string s, s1=":;>8", s2="()[]DPOX3";
int cnt, i;

int main(){
    ifstream cin("smiley.in");
    ofstream cout("smiley.out");

    while(cin>>s){
        for(int i=0; s[i]; i++){
            if(s1.find(s[i])){
               cout<<s[i]<<" ";
                i++;
                while(s[i]=='-'){
                    i++;
                }
                if(s[i] && s2.find(s[i])){
                    cnt++;
                }
                else{
                    i--;
                }
            }
        }
    }

    cout<<cnt;

    return 0;
}
Editor is loading...