Advertisement
gosuodin

demkitugiong nhau

Jun 8th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. int giongnhau(string s1, string s2) {
  5. int dem = 0;
  6. for (int i = 0; i < s1.size(); i++) {
  7. for (int j = 0; j < s2.size(); j++) {
  8. if (s1[i] == s2[j]) {
  9. dem = dem + 1;
  10. }
  11. }
  12. }
  13. return dem;
  14. }
  15. void main() {
  16. string s1, s2;
  17.  
  18. cout << giongnhau("abcde", "abee");
  19. system("pause>null");
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement