How to find common characters of two strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find common characters of two strings

I'm having issues starting this problem. The user needs to input 2 strings and the out put should tell you which letters are common in each carrot and parrot, the output should say common characters is arrot.

7th Feb 2023, 11:49 PM
Knighthawk
4 Answers
+ 3
Some people love the "sink or swim" idea. Luckily, you can be pushed around and a bit further without too much pain. There is a lot of information here and online that can help you out. Try not to think in terms of "I haven't been taught this", that's for kids in school. Think more "how can I learn this?"
8th Feb 2023, 2:00 AM
Ausgrindtube
Ausgrindtube - avatar
+ 2
You could separate each string into arrays of characters then compare and match each of them in a loop.
8th Feb 2023, 12:12 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
That's true. I'm in a beginner programming class and what's being taught is not beginner 😅 he's having us do work that involves using different methods from all over the book.
8th Feb 2023, 12:23 AM
Knighthawk
+ 1
Look under “Sets” and their operators.
9th Feb 2023, 2:03 PM
John van Lohuizen
John van Lohuizen - avatar