본문 바로가기
파이썬 코딩테스트/해커랭크

HackerRank / Two Strings / Python

by S.T.Lee 2022. 1. 2.

https://www.hackerrank.com/challenges/two-strings/problem?isFullScreen=true

 

Two Strings | HackerRank

Given two strings, you find a common substring of non-zero length.

www.hackerrank.com

s1과 s2가 겹치는 단어가 있으면 Yes

없으면 No

 

def twoStrings(s1, s2):
    # Write your code here
    for s in s1:
        if s in s2:
            return "YES"
    return "NO"