+ 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
11 ответов
+ 3
https://code.sololearn.com/cn7wS3ODl2ZP/?ref=app
Tell me if you find any bugs pls ^^
+ 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
+ 4
bro add more examples
i think
abcdef is input1
fedcba is input2
+ 3
thanks wait for few minutes , i am starting coding.
your question is best , should be on hackerearth.com
+ 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😅
+ 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!!
+ 2
input 1 ; 123
input 2; 321422312321
output is 3
321- 1st occurnce
231- 2nd occurnce
321- 3rd occurence
+ 2
@mr.programmer
input 1: abcdef
input 2: fedcba
output: 1
fedcba -1st occurnence
+ 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
+ 2
input 1 : omg
input 2 : mygomymogoogmomg
output: 4
gom -1st occurence
mog -2nd occurence
ogm - 3rd occurence
omg- 4th occurence
+ 2
@offline
good coding man