Skip to content

Instantly share code, notes, and snippets.

@vitorizkiimanda
Created March 20, 2018 04:37
Show Gist options
  • Save vitorizkiimanda/41fd6579d6878a082bec9b5672a0f214 to your computer and use it in GitHub Desktop.
Save vitorizkiimanda/41fd6579d6878a082bec9b5672a0f214 to your computer and use it in GitHub Desktop.
#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