Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add @imkaka as a contributor * Day 3 + Day2 README correction
- Loading branch information
1 parent
3befec1
commit 0075efe
Showing
4 changed files
with
85 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* @author : imkaka | ||
* @date : 24/12/2018 | ||
*/ | ||
|
||
#include<iostream> | ||
#include<string> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
|
||
string str1, str2; | ||
|
||
cin >> str1 >> str2; | ||
|
||
int dis = 0; | ||
if(str1.size() != str2.size()) | ||
cout << "Not Valid Strings for Hamming Distance Problem!!" << endl; | ||
else{ | ||
|
||
for(int i=0; i < str1.size(); ++i){ | ||
|
||
if(str1[i] != str2[i]) dis++; | ||
|
||
} | ||
|
||
cout << "Hamming Distance b/w " << str1 << " and " << str2 << " is " << dis << "." << endl; | ||
} | ||
|
||
return 0; | ||
} |
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