Sobes.tech
Intern — Middle

Counting the number of characters from the first line in the second considering case

livecode

Task condition

It is necessary to write a function that takes two strings — one with a set of characters (pattern) and another with arbitrary text (source). The function should return the number of all occurrences of characters from the first string in the second text, distinguishing case.

/*
Example 1:
Input: pattern = "aA", source = "aAAbbbb"
Output: 3

Example 2:
Input: pattern = "z", source = "ZZ"
Output: 0
*/
int countMatches(std::string pattern, std::string source) {

}