Marked as difficult questions, but it feels like that, remember the function to capitalize. The difficulty of the school's retest questions and the leetcode is too big.
#include <iostream>
#include <string>
using namespace std;
int main(){
string s;
getline(cin,s);
if(s.length()!=0)
s[0]=toupper(s[0]);
for(int i=0;i<s.length();i++){
if(s[i]==' '||s[i]=='\t'||s[i]=='\r'||s[i]=='\n')
s[i+1]=toupper(s[i+1]);
}
cout<<s<<endl;
}