Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue in cancer.alan #41

Closed
purpl3F0x opened this issue Nov 27, 2024 · 2 comments · Fixed by #42
Closed

Possible issue in cancer.alan #41

purpl3F0x opened this issue Nov 27, 2024 · 2 comments · Fixed by #42

Comments

@purpl3F0x
Copy link
Contributor

I think,
there is an issue in cancer.alan.

At the main function, there is an "strlen" algorithm that calculates the String length "n", then decrements the value by 1. (lines 24-26).

Then n gets passed along the sting to cancer() and gets reduced again.

This will make only strings like "annaX" pass, instead of "anna"

@kostis
Copy link
Owner

kostis commented Dec 3, 2024

Thanks for the issue. Actually, I had already noticed this and had fixed it in my checked out version of the repository.

@purpl3F0x : can you please double check the #42 PR?

@purpl3F0x
Copy link
Contributor Author

@purpl3F0x : can you please double check the #42 PR?

Yes, it seems to be working, as intended.
Issue can be closed, as soon as the PR is merged.

> ./test_cancer.exe
Give a string with maximum length 30: anna
anna ... is palindrome

> ./test_cancer.exe
Give a string with maximum length 30: anNna
anNna ... is palindrome

> ./test_cancer.exe
Give a string with maximum length 30: bob          
bob ... is palindrome

> ./test_cancer.exe
Give a string with maximum length 30: alice
alice ... is not palindrome

> ./test_cancer.exe
Give a string with maximum length 30: anna  #<---has trailing space
anna  ... is not palindrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants