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
added capitalise in cpp #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Bhanu0202 it is not complete capitalization, the question is to capitalize first letter of each word in the string.
@MadhavBahlMD The code does capitalise first letter of each word. Please check it again. Also, let me know if I am still wrong.Thanks :) |
day6/cpp/anagrams.cpp
Outdated
} | ||
else{ | ||
int flag = 0, i; | ||
transform(sa.begin(), sa.end(), sa.begin(), ::tolower); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont convert strings to lower case.
README file says Do not ignore the letter case, so Abc and abc are not anagrams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the correction. I will update it soon.
sa[0] -= 32; | ||
for(int i = 0; i < l; i++){ | ||
if(sa[i] == 32 && sa[i+1] != 32){ | ||
sa[i + 1] -= 32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before subtracting 32 please check if sa[i + 1]
is a lower case alphabet or not. If it is an upper case letter, subtracting 32 will give incorrect answer.
(Same for Line 14
)
Input :
Abc
Output :
!bc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the correction. I will update it soon.
Please make sure you have done the following:
/Day<n>/
directory (Where n is for nth day)all-conributors-cli