1111A - Superhero Transformation I have tried map for tracking either a char is vowel or consonant.And then comparing both the map's element, I may have my expected solution.But implementing map it came to my mind that map is a sorted container.So I google it and from stackoverflow I found this articlefifo_map which actually acts according to plan.But using above mentioned way I have a compilation error(No such directory).Is there any way to include external headers? My submission is here
You could always use the reliable:
strchr is a C function. OP wants to do things in C++.
Well it works. Otherwise OP could use a normal if with 5 conditions.
If he needs something with C++ he could use an unordered_set:
Thanks a lot.I just kinda curious if I could solve it using map?
You're trying way too hard for a simple problem. You can solve without using
unordered_map
. I, as a rule of thumb, like to keep things simple wherever they can be kept simple. Even you should try very simple implementations. You should also note that CF will not store every available library implementation available on the internet. We have the STL here only sofifo_map.hpp
isn't available, wherever you found it. To use an unordered_map, use the library implementation instead of a third party source.So, in order to help you solve this problem:
Can the size of one string be increased to form the other string? No. So, two unequal length string will result in the answer being "No".
Vowels can only change to other vowels. Consonants can only change to other consonants. For every position $$$i$$$ which is vowel in the one string, check if the same position in the other string is also a vowel. If not, answer is "No". Same to be done for consonants.
Implement a utility function isVowel() that checks if a given character is a vowel or not.