/**
 * Given a list of photos, where each photo is represented by a set of tags,
 * and a set of tags, return a set of all the common tags that appear in all the photos.
 *
 * @param photos List of photos, where each photo is represented by a set of tags.
 * @param tags Set of tags.
 * @return Set of all the common tags.
 *
 * Example:
 * val photos = setOf(setOf("landscape", "nature"),
 *                    setOf("portrait", "people", "nature"),
 *                    setOf("sunset", "landscape", "nature", "color"))
 *
 * val tags = setOf("landscape", "nature")
 *
 * getCommonTags(photos, tags) => setOf("landscape", "nature")
 */
fun getCommonTags(photos: List<Set<String>>, tags: Set<String>): Set<String> {

    val commonTags = tags.toMutableSet()
    for (photo in photos) {
        commonTags.retainAll(photo)
    }
    return commonTags
}
/**
 * Given a list of photos, where each photo is represented by a set of tags,
 * and a set of tags, return a set of all the common tags that appear in all the photos.
 *
 * @param photos List of photos, where each photo is represented by a set of tags.
 * @param tags Set of tags.
 * @return Set of all the common tags.
 *
 * Example:
 * val photos = setOf(setOf("landscape", "nature"),
 *                    setOf("portrait", "people", "nature"),
 *                    setOf("sunset", "landscape", "nature", "color"))
 *
 * val tags = setOf("landscape", "nature")
 *
 * getCommonTags(photos, tags) => setOf("landscape", "nature")
 */
fun getCommonTags(photos: List<Set<String>>, tags: Set<String>): Set<String> {
/**
 * Given a list of photos, where each photo is represented by a set of tags,
 * and a set of tags, return a set of all the common tags that appear in all the photos.
 *
 * @param photos List of photos, where each photo is represented by a set of tags.
 * @param tags Set of tags.
 * @return Set of all the common tags.
 *
 * Example:
 * val photos = setOf(setOf("landscape", "nature"),
 *                    setOf("portrait", "people", "nature"),
 *                    setOf("sunset", "landscape", "nature", "color"))
 *
 * val tags = setOf("landscape", "nature")
 *
 * getCommonTags(photos, tags) => setOf("landscape", "nature")
 */
fun getCommonTags(photos: List<Set<String>>, tags: Set<String>): Set<String> {

    val commonTags = tags.toMutableSet()
    for (photo in photos) {
        commonTags.retainAll(photo)
    }
    return commonTags
}