Relative Content

Tag Archive for pythonstring

How do I find and move a string of consonants in python?

I am new to Python and need to make a Pig Latin translator, that reads a .txt file, and outputs a new piglatin .txt file for a project. But I cannot figure out how to move the consonant clusters to the end of the word. How would I make it so that I can move the consonant clusters to the right position?

Why is LeetCode Test Case failing in their validation, but the output is exactly as intended in my IDE?

I am attempting the Longest Substring Without Repeating Characters(https://leetcode.com/problems/longest-substring-without-repeating-characters/description/) problem. So it has been failing the 3rd test case where length of non repeating substring from ‘pwwkew’ should be 3. I created my code, which uses two pointers,
I start from first index comparing it with last index, until I get e match I increment i and move forward to 2nd index, 3rd index and so on, when I do get a match I split the string there, and continue it recursively on the 2 strings, kind of like quick sort. if my string is of length 2 and s[i]==s[j] i return 1 for test case 2.