I'm not sure what's wrong
Why doesn't my code check for the last 2 cases in Convert US date to EU date challenge? #include <iostream> #include <string> #include <sstream> #include <vector> using namespace std; int main() { string a; getline(cin,a); if(a[a.length()-5]=='/'){ stringstream s(a); vector <string> v; string b; while(getline(s,b,'/')){ v.push_back(b); } cout<<v[1]<<'/'<<v[0]<<'/'<<v[2]; }else{ stringstream s(a); string b,c,d; s>>b>>c>>d; c.erase(c.length()-1); string month1[]= {"January","February","March","April","May","June","July","August","September","October","November","December"}; string month2[]= {"1","2","3","4","5","6","7","8","9","10","11","12"}; for(int i=0; i<12; i++){ if(b==month1[i]){ b=month2[i]; } } cout<<b<<'/'<<c<<'/'<<d; } return 0; }