Skip to content

Tag Archives: Python string-programs

Given a list of words, extract all the indices where those words occur in the string. Input : test_str = ‘geeksforgeeks is best for geeks… Read More
Given a character mesh, containing missing characters, match the string which matches the mesh. Example: Input : test_list = [“geeks”, “best”, “peeks”], mesh = “_ee_s” Output… Read More
Given a string, extract all the alphanumerics before 1st occurrence of non-alphanumeric. Input : test_str = ‘geek$s4g!!!eeks’ Output : geek Explanation : Stopped at $ occurrence. Input… Read More
Given a list of strings. The task is to split the string by the given list of strings.  Input : test_str = ‘geekforgeeksbestforgeeks’, sub_list =… Read More
Given a String, Split into words ignoring space formatting characters like \n, \t etc. Input : test_str = ‘geeksforgeeks\n\r\\nt\t\n\t\tbest\r\tfor\f\vgeeks’ Output : [‘geeksforgeeks’, ‘best’, ‘for’, ‘geeks’] Explanation :… Read More
Given a String replace each vowel with next vowel in series. Input : test_str = ‘geekforgeeks’ Output : giikfurgiiks Explanation : After e, next vowel… Read More
Given a String, check if it contains any number. Input : test_str = ‘geeks4g2eeks’ Output : True Explanation : Contains 4 and 2. Input :… Read More
Given a list of strings. The task is to find the index of the character position for the word, which lies at the Kth index… Read More
Given a string with words, concatenate Kth index of each word. Input : test_str = ‘geeksforgeeks best geeks’, K = 3 Output : ktk Explanation : 3rd… Read More
Given a String, compute all the characters, except spaces. Input : test_str = ‘geeksforgeeks 33 best’ Output : 19 Explanation : Total characters are 19.… Read More
Given a String, extract all the K length consecutive characters. Input : test_str = ‘geekforgeeeksss is bbbest forrr geeks’, K = 3 Output : [‘eee’,… Read More
Given two strings, check if substring characters occur in correct order in string. Input : test_str = ‘geeksforgeeks’, K = ‘sees’ Output : True Explanation… Read More
Given String list, extract frequency of specific characters in whole strings list. Input : test_list = [“geeksforgeeks is best for geeks”], chr_list = [‘e’, ‘b’,… Read More
Given a String, find length of longest consecution, in which K doesn’t appear. Input : test_str = ‘geeksforgeeks is best for geeks’, K = ‘e’… Read More
Given a String, split it into incremental sizes consecutive list. Input : test_str = ‘geekforgeeks is best’ Output : [‘g’, ‘ee’, ‘kfo’, ‘rgee’, ‘ks is’,… Read More