#include <iostream>
#include <string>
using namespace std;
int main()
{
int timeuno;
cin >> timeuno;
string suffixuno;
cin >> suffixuno;
cout << "First time: " << timeuno << suffixuno;
int timedos;
cin >> timedos;
string suffixdos;
cin >> suffixdos;
cout << "\n Second time: " << timedos << suffixdos;
if (suffixuno == "pm" && timeuno != 12) {
timeuno += 12;
}
if (suffixdos == "pm" && timedos != 12) {
timedos += 12;
}
if (timeuno == 12) {
timeuno -= 12;
}
if (timedos == 12) {
timedos -= 12;
}
if (timeuno < timedos)
{
cout << "\n Before" << endl;
}
else if (timeuno == timedos)
{
cout << "\n Same" << endl;
}
else
{
cout << "\n After" << endl;
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: