DC Challenge[24/05/2021]
Function customCompare
Example input/Output 1:
AbcdEFghi
jklAmnEopF
Output:
1
Solution:
#include<string.h>
int customCompare(char str1[],char str2[]){
char upper1[101],upper2[101];
int ind1=0,ind2=0;
for(int index=0;index<strlen(str1);index++)
{
if(isupper(str1[index]))
upper1[ind1++]=str1[index];
}
upper1[ind1]='\0';
for(int index=0;index<strlen(str2);index++){
if(isupper(str2[index]))
upper2[ind2++]=str2[index];
}
upper2[ind2]='\0';
return strcmp(upper1,upper2)==0;
}
Comments
Post a Comment