개발자/C or C++

[백준] 1316번

Mosser 2021. 10. 1.
728x90
반응형

소스코드

 

#include <iostream>
#include <cstring>
using namespace std;

#define SIZE 101

int main(){
    int numberOfword;
    cin>>numberOfword;
    char word[SIZE];
    char temp[26];
    int count=0;
    int s=0;
    int i=0;
    int j=0;
    int k=0;
    bool flag=false;
    int len=0;


    for(s=0;s<numberOfword;s++){

        cin>>word;
        len=strlen(word);

        for(i=0;i<len;i++){
            if(i==0){
                temp[j++]=word[i];
                continue;
            }

            if(word[i-1]==word[i])
                continue;
            else{
                for(k=0;k<j;k++){
                    if(word[i]==temp[k]){
                        flag=true;
                        break;
                    }
                }
            }
            if(flag){
                break;

            }else{
                temp[j++]=word[i];
            }
        }

        if(flag==false)
            count++;

        flag=false;
        j=0;

    }
    cout<<count<<endl;
}

 

반응형

'개발자 > C or C++' 카테고리의 다른 글

[백준] 2941번  (0) 2021.10.02
[백준] 5622번  (0) 2021.10.02
[백준] 1156번  (0) 2021.10.01
[백준] 2675번  (0) 2021.10.01
[백준] 10809번  (0) 2021.10.01

댓글