Question: In this puzzle, you have to split a string into separate parts, compare them, and recognize similar strings using a case-insensitive algorithm. You also have
In this puzzle, you have to split a string into separate parts, compare them, and recognize similar strings using a case-insensitive algorithm.
You also have to create and use an associative array and go through a large dataset of elements.
STATEMENT
Back to basics with this puzzle where you have to associate file names with their MIME type.
#include
using namespace std;
/** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. **/ int main() { int N; // Number of elements which make up the association table. cin >> N; cin.ignore(); int Q; // Number Q of file names to be analyzed. cin >> Q; cin.ignore(); for (int i = 0; i < N; i++) { string EXT; // file extension string MT; // MIME type. cin >> EXT >> MT; cin.ignore(); } for (int i = 0; i < Q; i++) { string FNAME; // One file name per line. getline(cin, FNAME); }
// Write an action using cout. DON'T FORGET THE "<< endl" // To debug: cerr << "Debug messages..." << endl;
// For each of the Q filenames, display on a line the corresponding MIME type. If there is no corresponding type, then display UNKNOWN. cout << "UNKNOWN" << endl; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
