For this Question: Given a string s consisting of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.

If the last word does not exist, return 0.

Note: A word is defined as a character sequence consists of non-space characters only.Input contains a single line string.

Constraints:

1 <= |String length| <= 100000Output the length of the last word.Sampe input 1
Hello World

Sample output 1
5


Explanation
Given s = "Hello World",

return 5 as length("World") = 5.

Please make sure you try to solve this problem without using library functions. Make sure you only traverse the string once., I have written this Solution Code: #include<bits/stdc++.h>
using namespace std;

#define pu push_back
#define fi first
#define se second
#define mp make_pair
#define int long long
#define pii pair<int,int>
#define mm (s+e)/2
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(int i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define sz 200000
int A[2000][2000];
int vis[200][200];
int dist[200][200];
int xa[8]={1,1,-1,-1,2,2,-2,-2};
int ya[8]={2,-2,2,-2,1,-1,1,-1};
int n,m;
int val,hh;
int check(int x,int y)
{
if (x>=0 && y>=0 && x<n && y<m )return 1;
else return 0;
}
#define qw1 freopen("input1.txt", "r", stdin); freopen("output1.txt", "w", stdout);
#define qw2 freopen("input2.txt", "r", stdin); freopen("output2.txt", "w", stdout);
#define qw3 freopen("input3.txt", "r", stdin); freopen("output3.txt", "w", stdout);
#define qw4 freopen("input4.txt", "r", stdin); freopen("output4.txt", "w", stdout);
#define qw5 freopen("input5.txt", "r", stdin); freopen("output5.txt", "w", stdout);
#define qw6 freopen("input6.txt", "r", stdin); freopen("output6.txt", "w", stdout);
#define qw freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
 

signed main()
{
	
		
	
            

            string s;
            getline(cin,s);
            int n=s.size();
            int cnt=0,ans=0;
            for(int i=0;i<n;i++)
            {
                
                  if(s[i]==' ') cnt=0;
                  else cnt++;
                ans=max(ans,cnt);
            }
            cout<<cnt<<endl;
		
		


	
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?