Determine if a string has all unique characters: Difference between revisions
Content added Content deleted
(Added C++ solution) |
m (C++ solution made slightly neater) |
||
Line 678:
size_t len = str.length();
std::cout << "input: \"" << str << "\", length: " << len << '\n';
{
for (size_t j = i + 1; j < len; ++j)
Line 689 ⟶ 688:
<< "' (hex " << std::hex << static_cast<unsigned int>(str[i])
<< ") occurs at positions " << std::dec << i + 1
<< " and " << j + 1 << ".\n\n";
}
}
}
▲ std::cout << "String contains no repeated characters.\n";
}
|