Print common characters using Python


Given two strings, write code to print overlapping letters in alphabetical order.

For example:

#Given the following strings:
str1 = 'card'
str2 = 'shark'

#Your overlapping letters would be 'a' (1x) and 'r' (1x), 
#and they just happen to be in alphabetical order already, 
#so your code would return:

If there is no overlap between the two strings, you can print 'no overlap'.


Access restricted

Subscribe to premium account to see the solution.

Get premium now