Question: please provide runable code for leet code. I have given you the link of submission panel of leetcode where the code should run. Also provide
please provide runable code for leet code. I have given you the link of submission panel of leetcode where the code should run. Also provide me the screenshot(proof) of running the code in leetcode
leetcode submission link: https://leetcode.com/problems/length-of-last-word/
project code question:
Given a string s consisting of some words separated by some number of spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-space characters only.
Answer :
#include
//assume this value int main(){
//get the string string str ="hello poly awesome";
//store the length of last word int lastLength=0; //store index int index=0; //loop for complete string for(unsigned int i=0;i if(index!=0){ lastLength = index; } cout<<"The length of the last word is : "< return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
