Computer Science, asked by nidhi1033, 11 months ago

python function to return common characters between two strings​

Answers

Answered by priyanka996
0

Answer:

Given two strings, print all the common characters in lexicographical order. If there are no common letters, print -1. All letters are lower case.

Examples:

Input :

string1 : geeks

string2 : forgeeks

Output : eegks

Explanation: The letters that are common between

the two strings are e(2 times), k(1 time) and

s(1 time).

Hence the lexicographical output is "eegks"

Input :

string1 : hhhhhello

string2 : gfghhmh

Output : hhh

Similar questions