Number included also without using space#1
Open
Reas-blip wants to merge 2 commits intostephenwashington:masterfrom
Open
Number included also without using space#1Reas-blip wants to merge 2 commits intostephenwashington:masterfrom
Reas-blip wants to merge 2 commits intostephenwashington:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Description:
This pull request introduces a feature that processes an input expression by identifying numbers, replacing them with unique letters, and then formatting the output by "slotting" the original numbers back in place in the expression. The key improvement is that the code now works both with and without spaces between numbers, operators, and variables, whereas the original version only worked with spaces. This allows for greater flexibility when working with expressions.
How the Code Works:
Collecting the Input String:
Identifying Numbers:
123or45.67). It doesn't matter whether these numbers are surrounded by spaces or other characters—the program will still identify them correctly.Replacing Numbers with Letters:
a,b,c, etc.). This replacement is stored in a mapping, which associates each letter with its corresponding number.Collecting the Converted Output:
Slotting Numbers Back In:
Maintaining the Format:
Example:
Input with spaces:
Input without spaces:
Steps:
1is replaced witha.100is replaced withb.45.67is replaced withc.Converted Expression:
Output (with numbers slotted back):
Illustration:
Before Replacement (with spaces):
Before Replacement (without spaces):
After Replacing Numbers with Letters:
After Slotted Back (Final Output):
Usage:
To use this feature:
ChatGPT mostly wrote the bridge file but i implemented it in the main file