Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Conjuntos - Contar caracteres únicos
/*Escribir una función que reciba dos parámetros de tipo string y retorne la cantidad de caracteres únicos que aparecen en ambos strings.*/ #include <iostream> #include <string> #include <set> using namespace std; int unicos(string str1, string str2) { set<char> caracteres; for (char c : str1+str2) { caracteres.insert(c); } return caracteres.size(); } int main() { cout << unicos("a", "sopa") << endl; cout << unicos("manzana", "jugar") << endl; cout << unicos("dolorido", "cebra") << endl; }
run
|
edit
|
history
|
help
0
Tower of hanoi
typedef char*
CurDayMessage
MapTel
DSU on tree (http://codeforces.com/contest/600/problem/E)
AWE
PriQHotel2
cvcvcvcvv
remove_copy_if-30-Seconds-of-C++
work