fork(1) download
  1. #include <cstring>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. const short maxSize = 46;
  6.  
  7. int main() {
  8. int n, matchingLetters;
  9. cin >> n;
  10. cin.ignore();
  11. char *word_1 = new char[maxSize];
  12. char *word_2 = new char[maxSize];
  13. for (int i = 0; i < n; i++) {
  14. matchingLetters = 0;
  15. cin.getline(word_1, maxSize);
  16. cin.getline(word_2, maxSize);
  17. for (int j = 0; j < strlen(word_1); j++) {
  18. if (strchr(word_2, word_1[j])) {
  19. *strchr(word_2, word_1[j]) = '#';
  20. matchingLetters++;
  21. }
  22. }
  23. cout << "Case #" << i + 1 << ": " << strlen(word_1) + strlen(word_2) - 2 * matchingLetters << endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 3416KB
stdin
1 
kek
lol
stdout
Case #1:  3