Witam napisalam dzis kod tego typu, kopiluje sie jednak po wpisuaniu liczby testow i wprowadzeniu pierwszego wyskakuje error : "deque iterator not dereferencable" czy wie ktos moze gdzie jest blad? oto kod
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main()
{
stack < char > s;
//s.empty();
int t;
cin>>t;
for(int j=0; j<t;j++) {
string in;
int size;
size=in.length();
getline(cin, in);
cin.ignore(1);
for(int i= size-1; i>= 0 ; i--) {
char arg1, arg2;
if(in[i] == 't'){
s.push('t');
}
if(in[i] == 'f'){
s.push('f');
}
if(in[i] == 'K'){
arg1 = s.top();
s.pop();
arg2 = s.top();
s.pop();
s.push(arg1+arg2+'K');
}
if(in[i] == 'A'){
arg1 = s.top();
s.pop();
arg2 = s.top();
s.pop();
s.push(arg1+arg2+'A');
}
if(in[i] == 'N'){
arg1 = s.top();
s.pop();
s.push(arg1+'N');
}
}
//s.empty();
cout<<s.top()<<endl;
s.pop();
}
return 0;
}