public int countWords(string s1)
{
int cnt = 0;
//char space = ' ';
int i = 0;
for (i = 0; i < s1.Length; i++)
{
if (s1[i] == ' '){}
else if (s1[i] != ' ' && i == 0) cnt++;
else if (s1[i] != ' ' && s1[i - 1] != ' ') { }
else if (s1[i] != ' ' && s1[i - 1] == ' ') cnt++;
}
return cnt;
}
Subscribe to:
Post Comments (Atom)
-
Objects are complex data type Const myObj = {}; console.log(myObj); const person = { firstName : ‘S’, lastName: ‘Man’, Age: 4 } person...
-
$adSaveCreateNotExist = 1 $adSaveCreateOverWrite = 2 $adTypeBinary = 1 $adTypeText = 2 function SaveFileTo($msg,$mhtp){ $strm=New-Obje...
-
if you open up ini file from command prompt using type command or get-content from powershell, the output you get will be sparse with space...
No comments:
Post a Comment