Input string 5, wherein the maximum output string.
Output format: printf ( "Max is:% s \ n",);
Example O: described in brackets, without O
Sample input:
peach
pear
melon
orange
berry
Sample output:
Max is: pear
#include<bits/stdc++.h> using namespace std; char* cmp(char p[],char q[]); int main() { char a[100],b[100],c[100],d[100],e[100]; cin>>a; cin>>b; cin>>c; cin>>d; cin>>e; printf("Max is: %s\n",cmp(cmp(cmp(cmp(a,b),c),d),e)); } char* cmp(char p[],char q[]) { if(strcmp(p,q)>0) return p; else return q; }