Friday, February 6, 2026

Count the number of occurrences of k in S (Super Easy)

Index of "Algorithms: Design and Analysis"
<<< Previous    Next >>>

Try solving on Hacker Earth

def solve (S, k):
    # Write your code here
    return S.count(k)

T = int(input())
for _ in range(T):
    S = input()
    k = input()

    out_ = solve(S, k)
    print (out_)

No comments:

Post a Comment