// length of string using for loop

#include <stdio.h>
#include<string.h>

int main() {
    char a[20],b;
    int i,l=0;
    scanf("%[^\n]%*c",a);
    l=strlen(a);
    b=' ';
    
    for(i=0;i<l;i++){
        if(a[i]!=b){
            printf("\n%c",a[i]);
        }else
        printf("\n$");
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: