Skip to content

How do you find the non-matching characters in a string when it comes to programming? #1667

Answered by Emojees
Kuefo asked this question in Q&A
Discussion options

You must be logged in to vote

The idea is to use nested loops: for each character in string s1, check whether it is present in string s2 or not. Likewise, for each character in string s2, check whether it is present in string s1 or not. Create an array check[] of size MAX_CHAR (where MAX_CHAR is set to 26 for lowercase English letters) to flag the already used characters. Store the uncommon characters in a character array or string. Finally, sort the characters in ascending order and print the result.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Kuefo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants