Ispit.cpp Apr 2026
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
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
A new word starts immediately following a space character. Iterate through the string, and whenever a space is detected, the next non-space character is the start of a new word. ispit.cpp
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++) cout << endl; return 0; Use code with caution. Copied to clipboard The program reads a line of text containing
This implementation provides the logic found in repository solutions like marko1597's Programming-competitions .
The very first character of the string (if it exists and is not a space) is always part of the result. Iterate through the string, and whenever a space
if (!input.empty() && !isspace(input[0])) std::cout << (char)toupper(input[0]); Use code with caution. Copied to clipboard