+ 8
What's the wrong in this code?
#include <iostream> #include <string> std::string dejaVu(std::string); std::string dejaVu(std::string saisie) { std::string result; for (size_t i = 0; i < saisie.size(); i++) { if (saisie.find_first_of(saisie[i]) != i) { result = "Deja Vu"; break; } else { result = "Unique"; } } return result; } int main() { std::string str = "sammich"; std::cout << dejaVu(str); return 0; }
5 Respostas
+ 3
How? it show 2 test wrong.
+ 1
It works in PC.
I think there is no problem on it.
+ 1
Did you consider case with empty input?