Python Solution


  • 0
    P

    class Solution(object):
    def findWords(self, words):
    """
    :type words: List[str]
    :rtype: List[str]
    """
    re_words = []
    str1 = 'qwertyuiop'
    str2 = 'asdfghjkl'
    str3 = 'zxcvbnm'
    for word in words:
    word = word.lower()
    for str0 in [str1, str2, str3]:
    flag = 1
    for letter in word:
    if str0.find(letter) == -1:
    flag = 0
    break
    if flag == 1:
    word = word.capitalize()
    re_words.append(word)
    return re_words


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.