Question: python programming N [MLB (1) 1 0 https:/ Bb Annou O cs x @ (1) [E| G When HE G What N 10|4 Home +
python programming

N [MLB (1) 1 0 https:/ Bb Annou O cs x @ (1) [E| G When HE G What N 10|4 Home + X Maples GN| blackboard.stonybrook.edu CSE101-Final-$20.pdf OX CSE101-Final-$20.pdf 3/6 . User Problem 3: (18 points) O X D Write a stretch () function, which takes one argument: a string containing only lowercase letters. The 2# 3:55 LH PC V ZIP function returns a new string where each character from the input string is repeated as many times as it has already been seen. In other words, the character is doubled the second time it appears, tripled the 2020-06-10 X third time it appears, etc. C . . Acrobat 2020-06-07 Reader DC Some test cases: O DE 9 O 2020-04-04 Chrome > > >stretch ("hihi") hihhii > > >stretch ("repetitive") Microsoft Edge repeetittiiveee D e An explanation of the second example is as follows: League of lexplorer + Legends 1. The first letter is 'r'. This is the first time we've seen this letter, so we append "r" to our result: "r". 2. The second letter is 'e'. This is the first time we've seen 'e', so we append "e": "re" UTorrent Pre 2010 Battle.r 3. The third letter is 'p'. This is the first time we've seen 'p', so we append "p": "rep". 4. The fourth letter is 'e'. This is the second time we've seen 'e', so we append "ee": "repee". 5. The fifth letter is 't'. This is the first time we've seen 't', so we append "t": "repeet". GeForce Steam MAT 6. The sixth letter is "i'. This is the first time we've seen 'i', so we append "i": "repeeti". Perience 7. The seventh letter is 't'. This is the second time we've seen 't', so we append "tt": "repeetitt". TALK 8. The eighth letter is "i'. This is the second time we've seen 'i', so we append "il": "repeetittii". Da 9. The ninth letter is 'v'. This is the first time we've seen 'v', so we append "v": "repeetittiiv". + EST 19 10. The final letter is 'e'. This is the third time we've seen 'e', so we append "eee": "repeetittiiveee". LO 2# 3:57 2020-06-18
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
