Boogallee 2017. 12. 29. 11:25



#include <iostream>

#include <string.h>

using namespace std;



int main()

{

    int n;

    int ans = 0;

    cin>>n;

    while(n--)

    {

        bool flag = false;

        int a = 0;

        string str;

        cin>>str;


        for(int i=0; i<str.length();i++)

        {

            int index = i;


            for(int j=i+1; j<str.length(); j++)

            {

//aaaabccd 처럼 a가 2번이상 반복일때 처리에서 틀렸엇지만 이 부분을 통해서 해결


                if(str[i] == str[j] && j-index == 1)   

                {

                    index = j;

                }

                else if(str[i] == str[j] && j-index != 1)

                    flag = true;

            }


        }


        if(!flag) ans++;



    }

    cout<<ans;



}