Back
Close

String methods

Statement
You must print these steps: Step 1: Check if str1 in str2 Step 2: Find first occurrence of str1 in str2 Step 3: Find last occurrence of str1 in str2 Step 4: Swap the case of str2 Step 5: Remove all extra spaces on the right in str2 Step 6: Remove all extra spaces on the left in str2 Step 7: Remove all extra spaces in str2 Note: If step 1 is false, you need not do step 2 and 3

Input description
str1: String str2: String

Output description
True/False:bool firstocc: int lastocc: int swappedcase: string rightremove: string leftremove: string remove: string

Constraints
0 < len(str1, str2) < 1000

Game modes

Test cases
Test 1 Test
Input
l Hello World!
Output
True 5 12 hELLO wORLD! Hello World! Hello World! Hello World!

Validator 1 Validator
Input
Hi, I am John Doe
Output
True 0 22 hI, i AM jOHN dOE Hi, I am John Doe Hi, I am John Doe Hi, I am John Doe

Test 2 Test
Input
z Z is not in string :(
Output
False z IS NOT IN STRING :( Z is not in string :( Z is not in string :( Z is not in string :(

Validator 2 Validator
Input
j J.J.Thompson discovered the electron
Output
False j.j.tHOMPSON DISCOVERED THE ELECTRON J.J.Thompson discovered the electron J.J.Thompson discovered the electron J.J.Thompson discovered the electron

Test 3 Test
Input
IDK IDK what to write, really IDK
Output
True 3 29 idk WHAT TO WRITE, REALLY idk IDK what to write, really IDK IDK what to write, really IDK IDK what to write, really IDK

Validator 3 Validator
Input
1 1+2+3+4+5+6+7=28
Output
True 3 3 1+2+3+4+5+6+7=28 1+2+3+4+5+6+7=28 1+2+3+4+5+6+7=28 1+2+3+4+5+6+7=28

Test 4 Test
Input
o hope you were able to solve it:)
Output
True 4 26 HOPE YOU WERE ABLE TO SOLVE IT:) hope you were able to solve it:) hope you were able to solve it:) hope you were able to solve it:)

Validator 4 Validator
Input
j You Shall Not Pass-Gandalf
Output
False yOU sHALL nOT pASS-gANDALF You Shall Not Pass-Gandalf You Shall Not Pass-Gandalf You Shall Not Pass-Gandalf

Solution language

Solution

Stub generator input