Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by Huy-Dong ( 6 years ago )
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char n[] = " Huy Dong Alo ";
int i,len;
len = strlen(n);
// Removing spaces at the beginning of string
while(1){
if (n[0] == 32){
for(i = 0;i < len-1;i++){
n[i] = n[i+1];
}
len--;
}
else break;
}
// Removing spaces at the ending of string
while(1){
if (n[len-2] == 32){
n[len-2] = 0;
len--;
}
else break;
}
// Removing spaces between 2 words
for(i = 1; i < len-1;i++){
if (n[i] == 32) {
if(n[i+1] == 32){
for(int j = i; j < len;j++) n[j] = n[j+1];
i--;
len--;
}
}
}
// UPPERCASE
for(i = 0; i < len ; i++){
if ((n[i]>96) && (n[i]<123)) n[i] -= 32;
}
printf("%s\nDo dai la: %d",n,len);
return 0;
}
Revise this Paste