Menu
Coddy logo textTech

Repeated Characters

Lesson 16 of 18 in Coddy's Functions in C++: Building Your Own Functions course.

challenge icon

Challenge

Medium

Write a function to find repeated characters in two strings.


The function find_repeated_characters takes two strings and returns all the characters that are repeated in both strings.

 

Example:

  • Input 1: "coddy"
  • Input 2: "code"
  • Output: "cod"

Try it yourself

#include <iostream>
#include <unordered_map>
using namespace std;

void findRepeatedChars(string str1, string str2) {
    

}

All lessons in Functions in C++: Building Your Own Functions