Why is the function asking for 5 arguments when only 4 appear to be required? This is almost identical to recommended code.
I get error:
1 2 3 4
: error C3867: 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::begin': non-standard syntax; use '&' to create a pointer to member
: error C2672: 'transform': no matching overloaded function found
: error C2780: '_DestTy *std::transform(const _InIt1,const _InIt1,_RightTy (&)[_RightSize],_DestTy (&)[_DestSize],_Fn)': expects 5 arguments - 4 provided
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.14.26428\include\algorithm(1501): note: see declaration of 'std::transform'
You have forgot the parentheses after the second begin.
Passing tolower just like that can sometimes lead to ambiguities errors because there are multiple functions with that name in the standard library. A more robust solution is to wrap it in a lambda so that the correct function gets looked up based its arguments.
Personally I don't have strong opinion. If you choose to use a loop you might want to use a range-based for loop instead of a regular for loop because you don't need the index.