+ 5

Todays final quiz😇

Create a program which takes 2 string inputs from the user. The task is to find the number of occurence of the 1st string in the second string. Note: It must also count the string if it is not the same string but contains the same characters in the string, i.e : if 1st string has "abcdef" and the second string is "feacdb", then the output is 1. eg: 1st input: think 2nd input : kinknthithinkinth output: 2 // i.e: knthi -1st occrnce think -2nd occrnce note: kinth in the lst is nt valid coz k is alrdy usd

31st May 2017, 8:34 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
11 odpowiedzi
+ 3
https://code.sololearn.com/cn7wS3ODl2ZP/?ref=app Tell me if you find any bugs pls ^^
31st May 2017, 9:43 AM
Dennis
Dennis - avatar
+ 7
My phone crashed 3 times. Sry that I am late :P It's asking for user input now. https://code.sololearn.com/WKYmy9NnSy1D/?ref=app
31st May 2017, 9:53 AM
Tim G
Tim G - avatar
+ 4
bro add more examples i think abcdef is input1 fedcba is input2
31st May 2017, 9:05 AM
MR Programmer
MR Programmer - avatar
+ 3
thanks wait for few minutes , i am starting coding. your question is best , should be on hackerearth.com
31st May 2017, 9:28 AM
MR Programmer
MR Programmer - avatar
+ 3
actually this is not my question at all i faced this question in a competitive programing contest, conducted by hacker rank i had only 4 test conditions passed out of 9 that time😅
31st May 2017, 9:30 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 3
@Dennis i checked your program with the inputs in the post all worked good😉 So, there is no bug as far as i know!!
31st May 2017, 9:56 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
input 1 ; 123 input 2; 321422312321 output is 3 321- 1st occurnce 231- 2nd occurnce 321- 3rd occurence
31st May 2017, 9:09 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
@mr.programmer input 1: abcdef input 2: fedcba output: 1 fedcba -1st occurnence
31st May 2017, 9:10 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
input 1: good input 2: moogdoodg output: 2 from charctr 2 to 5 ; oogd -1st occurnce note : here gdoo is invalid because the char gd is already used in the previous occurence !! so the next search starts from char 6 from charctr 6 to 9 : oodg - 2nd occurence
31st May 2017, 9:17 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
input 1 : omg input 2 : mygomymogoogmomg output: 4 gom -1st occurence mog -2nd occurence ogm - 3rd occurence omg- 4th occurence
31st May 2017, 9:23 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar
+ 2
@offline good coding man
31st May 2017, 9:58 AM
U L Knw Me soon😉😋
U L Knw Me soon😉😋 - avatar