The very first character of the string (if it exists and is not a space) is always part of the result.
The program reads a line of text containing multiple words and outputs a single string where each character represents the starting letter of a word in the original input. Input: mirko soft → Output: MS ispit.cpp
biti ali i ne biti → Output: BNB (Note: Single-letter words like 'i' are typically treated as full words depending on the specific problem constraints). Input: ali ja sam i jucer jeo → Output: AJSJJ Procedural Implementation Steps The very first character of the string (if
#include #include #include #include Use code with caution. Copied to clipboard Input: ali ja sam i jucer jeo →
Since the input contains spaces, std::getline is necessary to capture the full string. std::string input; std::getline(std::cin, input); Use code with caution. Copied to clipboard
#include #include #include using namespace std; int main() string s; getline(cin, s); // Output first character if(s.length() > 0) cout << (char)toupper(s[0]); // Look for spaces to find the start of the next words for(int i = 0; i < s.length(); i++) if(s[i] == '-' cout << endl; return 0; Use code with caution. Copied to clipboard