Challenge: Compare two words | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Challenge: Compare two words

Write a program (in any language that you like) that gets two words from user, and tells whether the words have the same letters and numbers of each letter. Comparison is not case-sensitive. Example : "apple" and "papel" both have one 'a', one 'e', one 'l' and two 'p', thus satisfying the given requirements. "teen" and "NEET" also satisfies. "sololearn" and "sololern" do not satisfy, bacause "sololearn" has one 'a' while "sololern" has no 'a'. "appeal" and "apparel" also does not satisfy.

21st Aug 2017, 10:26 PM
Jaydee Lucero
Jaydee Lucero - avatar
21 Answers
22nd Aug 2017, 2:10 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
22nd Aug 2017, 5:46 PM
Maz
Maz - avatar
+ 5
here you go in PHP https://code.sololearn.com/w3tlVO0YRSvu/#php just edit the two words at the beginning of the code. enjoy :) p.s. here there is c++ version https://code.sololearn.com/cgij8qZOXAkf/#cpp
21st Aug 2017, 11:04 PM
Luca
Luca - avatar
21st Aug 2017, 11:46 PM
ysraelcon
ysraelcon - avatar
22nd Aug 2017, 1:32 AM
Vari93
Vari93 - avatar
22nd Aug 2017, 2:46 PM
denk_n
denk_n - avatar
30th Oct 2017, 11:03 AM
Adib Attie
Adib Attie - avatar
+ 1
https://code.sololearn.com/ciPO4Mbn3aFV/#py
22nd Aug 2017, 11:12 AM
Rishi Anand
Rishi Anand - avatar
+ 1
16 lines, written in 2 minutes. https://code.sololearn.com/c0hx5pbM91fg/?ref=app
22nd Aug 2017, 8:55 PM
Timon Paßlick
22nd Aug 2017, 9:07 PM
Maria
Maria - avatar
+ 1
Open my code, it's implemented.
22nd Aug 2017, 9:18 PM
Timon Paßlick
0
this code copares words strings sentences anything...... input 2 strings seperated by enter https://code.sololearn.com/cvBqbY6JFsEA/?ref=app
22nd Aug 2017, 3:02 PM
sayan chandra
sayan chandra - avatar
0
What do you mean with registers? (english is not my mother language)
22nd Aug 2017, 9:11 PM
Timon Paßlick
0
@Timon PaBlick oh, I thought that if won't work with words "teen" and "TEEN".
22nd Aug 2017, 9:13 PM
Maria
Maria - avatar
0
Mine too, I'll fix it.
22nd Aug 2017, 9:14 PM
Timon Paßlick
0
Done.
22nd Aug 2017, 9:16 PM
Timon Paßlick
0
@Timon PaBlick will you show?
22nd Aug 2017, 9:17 PM
Maria
Maria - avatar
0
The statement in the 2 for loops is changed.
22nd Aug 2017, 9:19 PM
Timon Paßlick
0
@Timon Pablick yeah, fine.
22nd Aug 2017, 9:19 PM
Maria
Maria - avatar
22nd Aug 2017, 11:47 PM
Izi Lior Katie
Izi Lior Katie - avatar