Answer:
The code of the above program is provided below. using Python
Explanation:
<u>Code in Python 3:-
</u>
def modifyString(origString,charsToReplace,count):
# Make s1 as original string
s1=origString
# Make s2 as charsToReplace string in lowercase
s2=charsToReplace.lower()
# Make s3 as charsToReplace string in uppercase
s3=s2.upper()
# Initialize answer as an empty string
ans=''
# Iterate the string upto length times
for i in range(len(s1)):
# check for chars in the string and append to the answer
if (s1[i] in s2) or (s1[i] in s3):
ans=ans+count*s1[i]
else:
ans=ans+s1[i]
# return the final string
return ans
print(modifyString("Our cat is funny","aeiou",5))
print(modifyString("Our cat is funny","zu",3))