Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. string j, s;
  7. cin » j » s;
  8. vector <int> J(27,0), S(27, 0);
  9. for (size_t i = 0; i < j.size(); ++i) {
  10. J[j[i] - 'a']++;
  11. }
  12. for (size_t i = 0; i < s.size(); ++i) {
  13. S[s[i] - 'a']++;
  14. }
  15. int res = 0;
  16. for (size_t i = 0; i < 27; ++i) {
  17. if (J[i])
  18. res += S[i];
  19. }
  20. cout « res;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement