Created
March 20, 2018 04:37
-
-
Save vitorizkiimanda/41fd6579d6878a082bec9b5672a0f214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
string input1, input2; | |
float result=0; | |
getline(cin, input1); | |
getline(cin, input2); | |
for(int i=0;i<input1.length();i++) | |
input1[i] = tolower(input1[i]); | |
for(int i=0;i<input2.length();i++) | |
input2[i] = tolower(input2[i]); | |
if(input1 == input2) cout<<"Similarity : 100% "<<endl; | |
else { | |
for(int i=0;i<input1.length();i++) | |
if(input1[i]==input2[i]) result++; | |
printf("Similarity: %.2f\%\n", (result/input1.length())*100); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment