Write c++ program to compare two strings with necessary exception handling functions Refer sample input and output Input 1: 1113 output 1: Invalid Input Input 2: SRM SRM output 2: SRM IS SRM Input 3: sRM sRm Output 3: sRM IS NOT sRm Test Case 1 Input (stdin) SRM UNIVERSITY LEARNING CENTRE SRM UNIVERSITY LEARNING CENTRE Expected Output SRM UNIVERSITY LEARNING CENTRE IS SRM UNIVERSITY LEARNING CENTRE Test Case 2 Input (stdin) SRM UNIVERSITY SRM UNIVERSITY LEARNING CENTRE Expected Output SRM UNIVERSITY IS NOT SRM UNIVERSITY LEARNING CENTREsolution
#include <iostream> #include<string.h> using namespace std; int main() { char s[100],t[100]; cin.getline(s,100); cin.getline(t,100); if(s[0]<58 || t[0]<58) cout<<"Invalid Input"; else { if(strcmp(s,t)==0) cout<<s<<" IS "<<t; else cout<<s<<" IS NOT "<<t; } return 0; }