This is just the relevant part though. When I am trying to actually run this I get no errors until the deque starts to run. It never stops as it should do. When I checked what type of deque.max_size() was it returned -1 when one H was typed in. What am I missing?
max_size() doesn't return the vector's size (the name kinda implies that), but the largest theoretically possible size. The correct function is size().
char iword[200]; //uninitialized (contains garbage)
string iword2, astring;
int ilength=0, acount=0, ecount=0, icount=0, jcount=0, dcount=0;
iword2=iword; //using an uninitialized variable, undefined behaviour
ilength=iword2.length();
cin.get(iword, sizeof(iword)) cin.ignore(1000, '\n'); //now you are reading the input
deque<int>a_deque;
//HERE ¿what is the value of 'ilength'? ¿how is it related to 'iword' that you just read?
for(int i=0; i<ilength; i++){
if(iword[i]=='H'){