ᎻᎾᏯ ᴅᴏ ʏᴏᴜ ᴘʀɪɴᴛ ᴀ ᴅᴜᴘʟɪᴄᴀᴛᴇ ᴄʜᴀʀᴀᴄᴛᴇʀ ɪɴ ᴀ sᴛʀɪɴɢ?
₲ØØĐ ₥ØⱤ₦ł₦₲!
Answers
Answered by
5
Program to find the duplicate characters in a string
Explanation
In this program, we need to find the duplicate characters in the string.
To find the duplicate character from the string, we count the occurrence of each character in the string. If count is greater than 1, it implies that a character has a duplicate entry in the string. In above example, the characters highlighted in green are duplicate characters.
Algorithm
- Define a string.
- Two loops will be used to find the duplicate characters. Outer loop will be used to select a character and initialize variable count by 1.
- Inner loop will compare the selected character with rest of the characters present in the string.
- If a match found, it increases the count by 1 and set the duplicates of selected character by '0' to mark them as visited.
- After inner loop, if count of character is greater than 1, then it has duplicates in the string.
❥ the above is the answer of your question
❥ hope that's helps you
.
.
.
.
Very good morning dear ❤️..
have a great day ✨✨✨
Attachments:
Similar questions
Math,
1 month ago
English,
1 month ago
Geography,
1 month ago
Computer Science,
3 months ago
Computer Science,
3 months ago
Math,
10 months ago
Math,
10 months ago