String Comparision

  String Comparision 

 Problem Statement: 
The program must accept two string values S1 and S2 as the input. The program must print yes if the both the string values are equal. Else the program must no as the output.
Note: S1 and S2 contain only lowercase alphabets.

 Boundary Condition(S): 
1 <= Length of S1, S2 <=100

 Input Format: 
The first line contains the string S1.
The second line contains the string S2.

 Output Format: 
The first line contains either yes or no.

 Example Input/Output 1: 
 Input: 
eagle
eagle

 Output: 
yes

 Explanation: 
Both the string values (S1 and S2) are equal. So yes is printed as the output.

 Example Input/Output 2: 
 Input: 
tortoise
rabbit

 Output: 
no

 Note: Max Execution Time Limit: 4000 millisecs 

 Solution: 

 Programming Language: C Language 

#include <stdio.h>
#include <stdlib.h>
int main() {
    char a[101],b[101];
    scanf("%s%s",a,b);
    if(strcmp(a,b)){
        printf("no");
    }else{
        printf("yes");
    }
}

 (Note: Just incase the code shows any error kindly comment us with your feedback to help us improvise from our mistake.) 

Comments

Popular Posts

Property Inheritance in Family

Bit Party

Reversed Sum of Pairs

Sort Rows by Prime, Even and Odd Count

Integer - Alphabet Pairs to Matrix

Musical Bench