ProgrammersArmy Hiring Contest

Dear Coders,

I am trying to solve half birthday question CodeChef: Practical coding for everyone but I am getting the wrong answer CodeChef: Practical coding for everyone.

Kindly let me know what is wrong with my logic.

Thanks in advance!!

I think the link you have mentioned is not the link for your code.

Dear Biswa,

Here is my code:

#include <bits/stdc++.h>
#include <string.h>
#include
#include
#include
#define ll long long int
#define MAX 10e10
#define MOD 1000000009
using namespace std;

int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while(t–)
{
int d;
cin >> d;
string month;
cin >> month;
//cout << d << month;
if(month==“january”)
{
if(d<31)
cout << d+1 << " " << “july” << “\n”;
else
cout << 1 << " " << “august” << “\n”;
}

    if(month=="february")
    {
        if(d<=29)
        cout << d+1 << " " << "august" << "\n";
    }
    
    if(month=="march")
    {
        if(d==1)
        cout << 31 << " " << "august" << "\n";
        if(d>1 && d<=31)
        cout << d-1 << " " << "september" << "\n";
    }
    
    if(month=="april")
    {
        if(d<=30)
        cout << d << " " << "october" << "\n";
    }
    
    if(month=="may")
    {
        if(d==1)
        cout << 31 << " " << "october" << "\n";
        if(d>1 && d<31)
        cout << d-1 << " " << "november" << "\n";
    }
    
    if(month=="june")
    {
        if(d<=30)
        cout << d << " " << "december" << "\n";
    }
    
    if(month=="july")
    {
        if(d==1)
        cout << 31 << " " << "december" << "\n";
        if(d>1 && d<31)
        cout << d-1 << " " << "january" << "\n";
    }
    
    if(month=="august")
    {
        if(d==1)
        cout << 31 << " " << "january" << "\n";
        if(d>1 && d<=30)
        cout << d-1 << " " << "february" << "\n";
        if(d==31)
        cout << 1 << " " << "march" << "\n";
    }
    
    if(month=="september")
    {
        if(d<=30)
        cout << d+1 << " " << "march" << "\n";
    }
    
    if(month=="october")
    {
        if(d<31)
        cout << d << " " << "april" << "\n";
        else
        cout << 1 << " " << "may" << "\n";
    }
    
    if(month=="november")
    {
        if(d<=30)
        cout << d+1 << " " << "may" << "\n";
    }
    
    if(month=="december")
    {
        if(d<31)
        cout << d << " " << "june" << "\n";
        else
        cout << 1 << " " << "july" << "\n";
    }
        
}
return 0;

}