WA in TWTCLOSE

#include
#include

using namespace std;

int main()
{
	int n,k,count=0;
	string input;
	cin>>n>>k;
	cin.ignore();

	int tweet[1000];
	memset(tweet, -1, sizeof(tweet));
	for(int j=0;j<k;j++)
	{
		
		getline(cin,input);
		
		if(input=="CLOSEALL")
		{
			memset(tweet, -1, sizeof(tweet));
		}
		else
		{
			
			int index = input[6]-'0';
			tweet[index-1] *= -1;
		}
		for(int m=0;m<n;m++)
		{
			if(tweet[m]==1)
				count += 1;
		}
		cout<<count<<endl;
		count = 0;
	}
	return 0;
}

This returns WA for the question TWTCLOSE. Why?

index is wrong if index is > 10, should not be input[6], it will only get 1 digit, should be input.substr(6)

think about this case
20 6
CLICK 11
CLICK 12
CLICK 13
CLICK 12
CLOSEALL
CLICK 11

output should be
1
2
3
2
0
1

yours is
1
0
1
0
0
1

Modified and AC: CodeChef: Practical coding for everyone