Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::string check(const std::string&str) {
- std::string similar;
- bool have_this_symbol = false;
- for (int i = 0; i < str.size(); i++) {
- for (int l = 0; l < str.size(); l++) {
- if (l == i) {
- continue;
- }
- if (str[i] == str[l]) {
- for (int k = 0; k < similar.size(); k++) {
- if (similar[k] == str[l]) {
- have_this_symbol = true;
- }
- }
- if (!have_this_symbol) {
- similar += str[l];
- similar += " ";
- }
- have_this_symbol = false;
- }
- }
- }
- if (similar == "") {
- return "одинаковых символов нет";
- }
- else {
- return similar;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement