Hướng dẫn longest word in dictionary python - từ dài nhất trong từ điển python


Giả sử chúng ta có một danh sách các từ đại diện cho một từ điển tiếng Anh, chúng ta phải tìm từ dài nhất trong danh sách từ đã cho có thể được xây dựng một ký tự tại một thời điểm bằng các từ khác bằng lời nói. Nếu có nhiều hơn một câu trả lời có thể, thì hãy trả lại từ dài nhất với thứ tự từ vựng nhỏ nhất. Nếu không có câu trả lời, thì hãy trả lại chuỗi trống.

Vì vậy, nếu đầu vào giống như ["H", "he", "hel", "địa ngục", "xin chào"], thì đầu ra sẽ là "xin chào"

Để giải quyết vấn đề này, chúng tôi sẽ làm theo các bước này -

  • Trie: = một bản đồ mới
  • Xác định một hàm chèn (). Điều này sẽ lấy lời
  • Bây giờ: = Trie
  • Đối với mỗi C trong từ, làm
    • Nếu c không ở bây giờ -
      • Bây giờ [c] = {'#', false}, sau đó
    • Bây giờ: = Bây giờ [C]
    • Bây giờ ['#']: = true
  • Xác định một tìm kiếm chức năng (). Điều này sẽ lấy lời
  • Bây giờ: = Trie
  • Đối với mỗi C trong từ, làm
    • Nếu c không ở bây giờ -
      • Bây giờ [c] = {'#', false}, sau đó
    • Bây giờ: = Bây giờ [C]
    • Bây giờ ['#']: = true
  • Xác định một tìm kiếm chức năng (). Điều này sẽ lấy lời
    • Nếu '#' trong bây giờ và không phải bây giờ ['#'] là đúng, thì
  • trả lại sai
  • Xác định một tìm kiếm chức năng (). Điều này sẽ lấy lời
    • Nếu '#' trong bây giờ và không phải bây giờ ['#'] là đúng, thì
      • trả lại sai
  • trả lại ngay bây giờ ['#']

Đối với mỗi từ trong các từ, hãy làm

Gọi Chèn (Word)

Ans: = Chuỗi trống

class Solution:
   def longestWord(self, words):
      self.trie = {}
   def insert(word):
      now = self.trie
      for c in word:
         if c not in now: now[c] = {'#': False}
            now = now[c]
         now['#'] = True
   def search(word):
      now = self.trie
      for c in word:
         if '#' in now and not now['#']: return False
            now = now[c]
         return now['#']
         for word in words:
            insert(word)
         ans = ""
         for word in words:
            if (search(word) and (len(word) > len(ans) or (len(word) == len(ans) and word    < ans))):
         ans = word
      return ans
ob = Solution()
print(ob.longestWord(["h","he","hel","hell", "hello"]))

Nếu tìm kiếm (từ) và (kích thước của từ> kích thước của ANS hoặc (kích thước của từ giống như kích thước của ANS và WORD

["h","he","hel","hell", "hello"]

Ans: = Word

hello

Hướng dẫn longest word in dictionary python - từ dài nhất trong từ điển python

trả lại ans

  • Hãy cho chúng tôi xem việc thực hiện sau đây để hiểu rõ hơn -
  • Thí dụ
  • & nbsp; bản demo trực tiếp
  • Đầu vào
  • Đầu ra
  • Cập nhật vào ngày 04-tháng 1-2020 09:55:08
  • Câu hỏi và câu trả lời liên quan
  • Từ dài nhất trong từ điển thông qua việc xóa trong C ++
  • Từ điển từ sử dụng python tkinter
  • Hình thành từ dài nhất trong javascript
  • Cào và tìm từ được đặt hàng trong một từ điển trong Python
  • Chương trình tìm độ dài của chuỗi từ giảm dần nhất trong Python?
  • Họ có từ "từ điển" trong từ điển không?
  • Tìm từ lặp lại đầu tiên trong một chuỗi trong Python bằng từ điển
  • Tìm từ dài nhất trong một chuỗi trong javascript
  • Chương trình tìm chuỗi tiền tố dài nhất của một mảng từ trong python

Cải thiện bài viết

Lưu bài viết

  • Đọc
  • Bàn luận
  • Cải thiện bài viết

    Lưu bài viết

    Đọc

    Examples: 

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks

    Bàn luậnGoogle Interview  

    Đưa ra một từ điển và một chuỗi ‘str, hãy tìm chuỗi dài nhất trong từ điển có thể được hình thành bằng cách xóa một số ký tự của‘ str hồi. & Nbsp;

    Dưới đây là việc thực hiện ý tưởng trên & nbsp; & nbsp;

    C++

    #include

    using namespace std;

    bool isSubSequence(string str1, string str2)

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    3

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    6

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    9
    ["h","he","hel","hell", "hello"]
    2
    hello
    1

    hello
    2
    hello
    3
    hello
    4

    hello
    5
    hello
    6

    ["h","he","hel","hell", "hello"]
    1
    hello
    8
    hello
    9

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    1

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    4
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    9

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8 #include 2

    hello
    2
    hello
    3 #include 5

    hello
    5#include 7

    hello
    5#include 9

    hello
    5using1

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 using8

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    2 namespace1

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1namespace4

    Các

    ["h","he","hel","hell", "hello"]
    1std;6std;7
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1bool0

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 bool3

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Java

    bool5 bool6

    bool7 bool8

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1 isSubSequence(string str1, string str2)2 isSubSequence(string str1, string str2)3

    isSubSequence(string str1, string str2)4isSubSequence(string str1, string str2)5

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    3

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    03
    ["h","he","hel","hell", "hello"]
    044____105

    hello
    2
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    9
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    10
    ["h","he","hel","hell", "hello"]
    04
    ["h","he","hel","hell", "hello"]
    12

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5
    hello
    3
    ["h","he","hel","hell", "hello"]
    17

    hello
    5
    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    20
    hello
    6

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    8
    hello
    9

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1
    ["h","he","hel","hell", "hello"]
    33

    ["h","he","hel","hell", "hello"]
    34
    ["h","he","hel","hell", "hello"]
    35

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    44
    ["h","he","hel","hell", "hello"]
    04
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    49

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5
    hello
    3
    ["h","he","hel","hell", "hello"]
    54

    ["h","he","hel","hell", "hello"]
    20
    ["h","he","hel","hell", "hello"]
    56

    hello
    5
    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    20#include 9

    ["h","he","hel","hell", "hello"]
    20using1

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    8 using8

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    73 isSubSequence(string str1, string str2)1
    ["h","he","hel","hell", "hello"]
    75
    ["h","he","hel","hell", "hello"]
    76

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    80namespace7namespace8namespace9namespace8std;1namespace8std;3std;4

    hello
    2
    ["h","he","hel","hell", "hello"]
    90
    ["h","he","hel","hell", "hello"]
    91
    ["h","he","hel","hell", "hello"]
    92

    hello
    2
    ["h","he","hel","hell", "hello"]
    94std;7
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    ["h","he","hel","hell", "hello"]
    98

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Python3

    hello
    02
    hello
    03

    ["h","he","hel","hell", "hello"]
    1
    hello
    05
    hello
    06
    hello
    07
    hello
    08

    ["h","he","hel","hell", "hello"]
    1
    hello
    10
    hello
    06
    hello
    07
    hello
    13

    ["h","he","hel","hell", "hello"]
    1
    hello
    15
    hello
    06
    ["h","he","hel","hell", "hello"]
    04
    ["h","he","hel","hell", "hello"]
    05

    ["h","he","hel","hell", "hello"]
    1
    hello
    20
    hello
    06
    ["h","he","hel","hell", "hello"]
    04
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1
    hello
    25
    hello
    26
    hello
    27
    hello
    28

    hello
    2
    hello
    3
    hello
    31
    hello
    06
    hello
    06
    hello
    34

    hello
    5
    hello
    15
    hello
    37
    hello
    06
    hello
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    hello
    20
    hello
    37
    hello
    06
    hello
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1
    hello
    8
    hello
    49
    hello
    06
    hello
    06
    hello
    52

    hello
    02
    hello
    54

    ["h","he","hel","hell", "hello"]
    1
    hello
    56
    hello
    06
    hello
    58

    ["h","he","hel","hell", "hello"]
    1
    hello
    60
    hello
    06
    ["h","he","hel","hell", "hello"]
    04
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8
    hello
    66
    hello
    67
    hello
    68

    hello
    2
    hello
    3
    hello
    71
    hello
    07
    hello
    73
    hello
    27
    hello
    75

    hello
    5
    hello
    56
    hello
    06
    hello
    79

    hello
    5
    hello
    60
    hello
    06
    hello
    07
    hello
    84

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 using8

    ["h","he","hel","hell", "hello"]
    2 namespace1

    Các

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    03
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    04

    C#

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 bool3

    Java

    bool7 bool8

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1 isSubSequence(string str1, string str2)2 isSubSequence(string str1, string str2)3

    isSubSequence(string str1, string str2)4isSubSequence(string str1, string str2)5

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    3

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    03
    ["h","he","hel","hell", "hello"]
    044____105

    hello
    2
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    9
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    10
    ["h","he","hel","hell", "hello"]
    04
    ["h","he","hel","hell", "hello"]
    12

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5
    hello
    3
    ["h","he","hel","hell", "hello"]
    17

    hello
    5
    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    20
    hello
    6

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    8
    hello
    9

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    34
    ["h","he","hel","hell", "hello"]
    35

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1
    ["h","he","hel","hell", "hello"]
    33

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    44
    ["h","he","hel","hell", "hello"]
    04
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    49

    ["h","he","hel","hell", "hello"]
    20
    ["h","he","hel","hell", "hello"]
    56

    hello
    5
    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    20#include 9

    ["h","he","hel","hell", "hello"]
    20
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    80

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    8 using8

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    73 isSubSequence(string str1, string str2)1
    ["h","he","hel","hell", "hello"]
    75
    ["h","he","hel","hell", "hello"]
    76

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    80namespace7namespace8namespace9namespace8std;1namespace8std;3std;4

    hello
    2
    ["h","he","hel","hell", "hello"]
    90
    ["h","he","hel","hell", "hello"]
    91
    ["h","he","hel","hell", "hello"]
    92

    hello
    2
    ["h","he","hel","hell", "hello"]
    94std;7
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2#include 16

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello02 hello03

    #include 20

    ["h","he","hel","hell", "hello"]
    1
    hello
    05
    hello
    06
    hello
    07
    hello
    08

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1#include 29 #include 30#include 31
    ["h","he","hel","hell", "hello"]
    9#include 23#include 34

    ["h","he","hel","hell", "hello"]
    1#include 36 #include 30#include 31
    ["h","he","hel","hell", "hello"]
    9#include 25#include 34

    ["h","he","hel","hell", "hello"]
    1#include 43 #include 44

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    9#include 48

    hello
    2
    hello
    3
    ["h","he","hel","hell", "hello"]
    9#include 23
    hello
    90#include 43#include 66#include 25
    hello
    90#include 48#include 70

    hello
    5#include 43#include 73

    ["h","he","hel","hell", "hello"]
    1
    hello
    8
    ["h","he","hel","hell", "hello"]
    9#include 43 #include 78#include 29#include 34

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    #include 21 #include 83#include 84namespace8#include 86#include 26

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1#include 90 #include 30
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1#include 95 #include 96

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    64
    ["h","he","hel","hell", "hello"]
    9#include 84 using01 using022____426

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    hello
    3
    ["h","he","hel","hell", "hello"]
    9#include 95 #include 51#include 31
    ["h","he","hel","hell", "hello"]
    9using022

    using15#include 22using02namespace8#include 86using20

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5#include 90 #include 30using022

    hello
    5#include 95 #include 30#include 31
    ["h","he","hel","hell", "hello"]
    9using02234

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 #include 90
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Is

    #include 86 #include 30std;7

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    using60 #include 83#include 84namespace8#include 86#include 34

    using66

    JavaScript

    using67

    #include 21 using69

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1using72 using73

    ["h","he","hel","hell", "hello"]
    1using72
    ["h","he","hel","hell", "hello"]
    6

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8
    ["h","he","hel","hell", "hello"]
    9using72
    hello
    1

    hello
    2
    hello
    3
    hello
    4

    hello
    5
    hello
    6

    ["h","he","hel","hell", "hello"]
    1
    hello
    8
    hello
    9

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    #include 21 using92

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1using72 using96
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1using72
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    9

    ["h","he","hel","hell", "hello"]
    1namespace03

    hello
    2
    hello
    3 namespace06

    hello
    5#include 7

    hello
    5#include 9

    hello
    5namespace12

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1namespace16

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 using8

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    using72 namespace22

    ["h","he","hel","hell", "hello"]
    1namespace24namespace7namespace8namespace9namespace8std;1namespace8std;3
    hello
    98

    using72 namespace34std;7736

    namespace37

    namespace38

    Độ phức tạp về thời gian: O (n*(k+n)) ở đây n là độ dài của từ điển và n là độ dài của chuỗi đã cho 'str' và k - chiều dài tối đa của các từ trong từ điển ; & nbsp; O(N*(K+n)) Here N is the length of dictionary and n is the length of given string ‘str’ and K – maximum length of words in the dictionary.
    Auxiliary Space: O(1)  

    Một giải pháp hiệu quả là chúng tôi sắp xếp từ điển. Chúng tôi vượt qua tất cả các từ từ điển và với mỗi từ, chúng tôi kiểm tra xem đó có phải là chuỗi chuỗi đã cho không và cuối cùng chúng tôi kiểm tra sau đó & nbsp;efficient solution is we Sort the dictionary word. We traverse all dictionary words and for every word, we check if it is subsequence of given string and at last we check this subsequence  is largest of all such subsequence.. We finally return the longest word with given string as subsequence.

    C++

    #include

    using namespace std;

    ["h","he","hel","hell", "hello"]
    1namespace44
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    75 namespace49

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    ["h","he","hel","hell", "hello"]
    2 namespace54

    hello
    2
    ["h","he","hel","hell", "hello"]
    2 namespace57

    hello
    2
    hello
    25namespace60

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5
    hello
    3namespace65

    hello
    5
    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    20namespace69

    ["h","he","hel","hell", "hello"]
    20
    hello
    6

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    5namespace75

    using15

    hello
    6

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    3namespace82

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5namespace86

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    namespace91namespace92

    namespace93namespace94

    namespace93

    ["h","he","hel","hell", "hello"]
    8namespace97

    namespace93

    ["h","he","hel","hell", "hello"]
    0

    std;00std;01

    namespace93

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    namespace93

    hello
    8 std;06

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    2 namespace1

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1namespace4

    Các

    ["h","he","hel","hell", "hello"]
    1std;6std;7
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1std;29

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 bool3

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Java

    bool5 std;35

    bool5 bool6

    bool7 std;39

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1 std;42
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1
    ["h","he","hel","hell", "hello"]
    75 std;48

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    10
    ["h","he","hel","hell", "hello"]
    04
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    ["h","he","hel","hell", "hello"]
    2
    ["h","he","hel","hell", "hello"]
    03
    ["h","he","hel","hell", "hello"]
    04
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    2
    hello
    25std;61

    hello
    5
    hello
    3std;64

    ["h","he","hel","hell", "hello"]
    20std;66
    hello
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    20std;70
    hello
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    5namespace75

    ["h","he","hel","hell", "hello"]
    20std;70
    hello
    39
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    hello
    5
    hello
    3std;83

    ["h","he","hel","hell", "hello"]
    20std;85

    hello
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)1 std;94

    hello
    2std;96

    hello
    2
    ["h","he","hel","hell", "hello"]
    8std;99

    hello
    5std;01

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    8 std;06

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    73 isSubSequence(string str1, string str2)1
    ["h","he","hel","hell", "hello"]
    75 bool12

    ["h","he","hel","hell", "hello"]
    1bool14
    ["h","he","hel","hell", "hello"]
    91 bool16namespace7namespace8namespace9namespace8std;1namespace8__

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    94std;7
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    1bool30

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    Python3

    bool33

    hello
    06
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5

    hello
    02 bool37

    ["h","he","hel","hell", "hello"]
    1bool39 bool33

    ["h","he","hel","hell", "hello"]
    1
    hello
    20
    hello
    06
    ["h","he","hel","hell", "hello"]
    04

    ["h","he","hel","hell", "hello"]
    1
    hello
    15
    hello
    06
    ["h","he","hel","hell", "hello"]
    04

    Các

    hello
    2
    hello
    3bool60
    hello
    06
    hello
    06 bool63

    hello
    5
    hello
    20
    hello
    37
    hello
    06
    hello
    39

    hello
    5
    hello
    15
    hello
    37
    hello
    06
    hello
    39

    hello
    2namespace75bool76

    hello
    5
    hello
    15
    hello
    37
    hello
    06
    hello
    39

    Các

    hello
    5bool95
    hello
    06 bool97

    hello
    02 bool99

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)01

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8 isSubSequence(string str1, string str2)04
    hello
    67 isSubSequence(string str1, string str2)06

    hello
    2isSubSequence(string str1, string str2)08

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 bool33

    Is

    isSubSequence(string str1, string str2)23

    hello
    06 std;7

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    03isSubSequence(string str1, string str2)27namespace22namespace8isSubSequence(string str1, string str2)23using20

    JavaScript

    using67

    isSubSequence(string str1, string str2)33

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    5
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    #include 21 isSubSequence(string str1, string str2)37

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)40

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)42

    ["h","he","hel","hell", "hello"]
    1
    hello
    25isSubSequence(string str1, string str2)45

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2
    hello
    3isSubSequence(string str1, string str2)50

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5namespace69

    hello
    5
    hello
    6

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2namespace75

    hello
    5
    hello
    6

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    hello
    2
    hello
    3isSubSequence(string str1, string str2)67

    hello
    2
    ["h","he","hel","hell", "hello"]
    0

    hello
    5std;85

    hello
    2
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    #include 21 isSubSequence(string str1, string str2)77

    ["h","he","hel","hell", "hello"]
    0

    ["h","he","hel","hell", "hello"]
    1isSubSequence(string str1, string str2)80

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    8isSubSequence(string str1, string str2)83

    ["h","he","hel","hell", "hello"]
    1
    ["h","he","hel","hell", "hello"]
    0

    hello
    2isSubSequence(string str1, string str2)87

    ["h","he","hel","hell", "hello"]
    1
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    1
    hello
    8 std;06

    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    0

    ["h","he","hel","hell", "hello"]
    003std;7
    Input : dict = {"ale", "apple", "monkey", "plea"}   
            str = "abpcplea"  
    Output : apple 
    
    Input  : dict = {"pintu", "geeksfor", "geeksgeeks", 
                                            " forgeek"} 
             str = "geeksforgeeks"
    Output : geeksgeeks
    6

    ["h","he","hel","hell", "hello"]
    006
    ["h","he","hel","hell", "hello"]
    007#include 34

    namespace38

    Bài viết này được đóng góp bởi Nishant Singh. Nếu bạn thích GeekSforGeeks và muốn đóng góp, bạn cũng có thể viết một bài viết bằng Write.GeekSforGeek.org hoặc gửi bài viết của bạn. Xem bài viết của bạn xuất hiện trên trang chính của GeekSforGeek và giúp các chuyên viên máy tính khác.Nishant Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.


    Từ nào mất 3 giờ để nói pneumonoultramicroscopicsilicovolcanoconiosis?

    Từ tiếng Anh dài nhất từ dài nhất trong tiếng Anh có 189.819 chữ cái và mất 3 giờ để phát âm.Đây là một thuật ngữ kỹ thuật cho thành phần hóa học của Titin.Titin là protein lớn nhất được biết đến chịu trách nhiệm duy trì độ co giãn thụ động của các cơ.a technical term for the chemical composition of titin. Titin is the largest known protein responsible for maintaining the passive elasticity of the muscles.

    Từ 189 819 là gì?

    Isoleucine (189, 819 chữ cái) (189, 819 letters)

    Liệu pneumonoultramicroscopicsilicovolcanoconiosis có 45 chữ cái?

    Từ dài nhất được nhập trong hầu hết các từ điển tiếng Anh tiêu chuẩn là pneumonoultramicroscopicsilicovolcanoconiosis với 45 chữ cái.Định nghĩa của chúng tôi là "một bệnh phổi gây ra bởi việc hít phải bụi silicat rất mịn hoặc bụi thạch anh."Mục nhập cho từ này có thể được tìm thấy trong từ điển y tế của chúng tôi.. Our definition is "a lung disease caused by inhalation of very fine silicate or quartz dust." The entry for this word can be found in our Medical Dictionary.