Test Case 3 & 4 Failed.
#include <iostream> #include <sstream> #include <vector> using namespace std; /* Link to Safety Deposit Boxes: https://www.sololearn.com/coach/17?ref=app */ int main(){ string items; getline(cin, items); string myItem; cin>>myItem; stringstream ss(items); string token; vector<string> vectItem; //tokenize or get characters of ss then split once delimiter ',' is encountered while (getline(ss,token, ',')){ vectItem.push_back(token); //store tokenized ss } int itmqty = 1, time = 5; for(int i=0;i<vectItem.size();i++){ time *= itmqty; if(vectItem.at(i)==myItem){ break; } itmqty++; } cout<<time; return 0; }