Implement a program to find the longest word in a sentence.
MediumProblem Statement
Implement a program to find the longest word in a sentence.
Sample Input
std::string sentence = "Find the longest word in this sentence";
Sample Output
Longest word = sentence
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <iostream>
#include <sstream>
#include <string>
int main() {
std::string sentence = "Find the longest word in this sentence";
// Logic to find the longest word
return 0;
}
Input
std::string sentence = "Find the longest word in this sentence";
Expected Output
Longest word = sentence