<commit_before>/* Write a function escape(s,t) that converts characters like newline and tab into visible escape sequences like \n and \t as it copies the string t to s. Use a Switch. Write a function for 
the other direction as well,converting the escape sequences into the real characters */

#include<stdio.h>
#define MAXLINE 1000
int mgetline(char line[],int maxline);
void escape(char s[],char t[]);


int main(void)
{
	char s[MAXLINE],t[MAXLINE];

	putchar('t');
	mgetline(t,MAXLINE);

	escape(s,t);

	printf("%s",s);

	return 0;
}

void escape(char s[],char t[])
{
	int i,j;

	i=j=0;

	while(t[i] != '\0')
	{
		switch(t[i])
		{
			case '\t':
					s[j]='\\';
					++j;
					s[j]='t';
					break;
			case '\n':
					s[j]='\\';
					++j;
					s[j]='n';
					break;
			default:
					s[j]=t[i];
					break;
		}
		++i;
		++j;
	}
	
	s[j]='\0';
}

int mgetline(char s[],int lim)
{
	int i,c;

	for(i=0;i<lim-1 && (c=getchar())!=EOF && c !='\n';++i)
		s[i]=c;

	if(c=='\n')
		s[i++]=c;
	
	s[i]='\0';
}
<commit_msg>Update Ex_3.2_escape.c<commit_after>/* Write a function escape(s,t) that converts characters like newline and tab into visible escape sequences like \n and \t as it copies the string t to s. Use a Switch. Write a function for 
the other direction as well,converting the escape sequences into the real characters */

#include<stdio.h>
#define MAXLINE 1000
int mgetline(char line[],int maxline);
void escape(char s[],char t[]);


int main(void)
{
	char s[MAXLINE],t[MAXLINE];

	mgetline(t,MAXLINE);

	escape(s,t);

	printf("%s",s);

	return 0;
}

void escape(char s[],char t[])
{
	int i,j;

	i=j=0;

	while(t[i] != '\0')
	{
		switch(t[i])
		{
			case '\t':
					s[j]='\\';
					++j;
					s[j]='t';
					break;
			case '\n':
					s[j]='\\';
					++j;
					s[j]='n';
					break;
			default:
					s[j]=t[i];
					break;
		}
		++i;
		++j;
	}
	
	s[j]='\0';
}

int mgetline(char s[],int lim)
{
    int i,c;

    for(i=0;i<lim-1 && (c=getchar())!=EOF;++i)
        s[i]=c;

    s[i]='\0';
}
{'fraction_non_alphanumeric': 0.20843797086891008, 'fraction_numerical': 0.012054244098442994, 'mean_word_length': 2.9367588932806323, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503520', 'n_tokens_mistral': 985, 'n_tokens_neox': 848, 'n_words': 218}