Write a function oneSpaceAfterPeriod( String Parameter ) that will return a string with one space after every period. Another function twoSpaceAfterPeriod (String Parameter) that will return a string with two spaces after every period.
ONE SPACE METHOD
//method to provide one space after period symbol
string oneSpaceAfterPeriod(string s)
{
int i,j=0;
char s1[s.size()+1]; //allocate memory for a
character array according to size of s
for(i=0;i<s.length();i++)
{
if(s[i]=='.') //if period
symbol found
{
s1[j]='.';
//copy the period symbol to converted string
j++; //j
is used for the index of converted string
s1[j]=' ';
//assign a white space to the string
j++;
}
else
{ //copy all
charcters except period symbol
s1[j]=s[i];
j++;
}
}
s1[j]='\0'; //assign null to end
return s1; //return converted string
}
TWO SPACE METHOD
//method to provide two white spaces after period symbol
string twoSpaceAfterPeriod(string s)
{
int i,j=0;
char s1[s.size()+1];
for(i=0;i<s.length();i++)
{
if(s[i]=='.')//if period
symbol found
{
s1[j]='.';
//copy the period symbol to converted string
j++;//j is
used for the index of converted string
s1[j]=' ';
//assign a white space after period symbol
j++;
s1[j]='
';//assign second white space
j++;
}
else//copy all
charcters except period symbol
{
s1[j]=s[i];
j++;
}
}
s1[j]='\0'; //assign null to end
return s1; //return converted string
}
PROGRAM IMPLEMENTATIONS
#include<iostream>
using namespace std;
//method to provide one space after period symbol
string oneSpaceAfterPeriod(string s)
{
int i,j=0;
char s1[s.size()+1]; //allocate memory for a
character array according to size of s
for(i=0;i<s.length();i++)
{
if(s[i]=='.') //if period
symbol found
{
s1[j]='.';
//copy the period symbol to converted string
j++; //j
is used for the index of converted string
s1[j]=' ';
//assign a white space to the string
j++;
}
else
{ //copy all
charcters except period symbol
s1[j]=s[i];
j++;
}
}
s1[j]='\0'; //assign null to end
return s1; //return converted string
}
//method to provide two white spaces after period symbol
string twoSpaceAfterPeriod(string s)
{
int i,j=0;
char s1[s.size()+1];
for(i=0;i<s.length();i++)
{
if(s[i]=='.')//if period
symbol found
{
s1[j]='.';
//copy the period symbol to converted string
j++;//j is
used for the index of converted string
s1[j]=' ';
//assign a white space after period symbol
j++;
s1[j]='
';//assign second white space
j++;
}
else//copy all
charcters except period symbol
{
s1[j]=s[i];
j++;
}
}
s1[j]='\0'; //assign null to end
return s1; //return converted string
}
//driver program
int main()
{
string s,s1,s2;
cout<<endl<<"Enter a string";
getline(cin,s);//read the string
//display the string
cout<<endl<<"Entered String is :
"<<s;
s1=oneSpaceAfterPeriod(s); //call method to
provide one space
//display the converted
string
cout<<endl<<"Converted String with one
space after period is : "<<s1;
s2=twoSpaceAfterPeriod(s);//call method to provide two
spaces
//display the converted string
cout<<endl<<"Converted String with two
spaces after period is : "<<s2;
}
OUTPUT

Write a function oneSpaceAfterPeriod( String Parameter ) that will return a string with one space after...
Write a python function score_formatter() that takes one parameter, which is a formatted string that contains information about the score received by a student in a particular subject. The function analyzes the string and returns a reformatted string for the score. You will need to use the function re.sub that is discussed in the lecture notes. If the string does not match the pattern, the function returns the string "error". The input string is always given in the format specified...
Write a Python function make_triangle(trianglechar, triangleheight) that will return a string with an isosceles right triangle based on the two formal parameters triangle_height giving the triangle height and triangle_char that gives the symbol to be printed. Important notes: This program returns (not prints!) a string. For this function and the other part of this lab you are required to put in a docstring. That will be checked by a TA/grader reading the program. Every one of the occurrences of triangle_char...
#Write a function called check_formula. The check_formula #function should take as input one parameter, a string. It #should return True if the string holds a correctly #formatted arithmetic integer formula according to the rules #below, or False if it does not. # #For this problem, here are the rules that define a #correctly-formatted arithmetic string: # # - The only characters in the string should be digits or the five arithmetic operators: +, -, *, /, and =. Any other...
4. Write a C function int str2int(char *s) that takes string s as parameter and return the integer that s represents. For example, if string s is 123", then the function return integer 123.
Write a static method called printWithSpaces that takes a String as its parameter and prints the characters of the string separated by spaces. For example: > Methods.printWithSpaces("method") m e t h o d You should have a single space after the last character. This method should not return a value. That is similar to this code for printing the string vertically public static void printVertical(String s) { for (int i = 0; i < s.length(); i++) { char c =...
c++ Write a function Count_m_z that takes a string as an input parameter argument and counts the number of m, n, o, ... z characters in it. The function returns an integer value for the number of times those 14 lowercase letters appear in the input string. Your function should be named Count_m_z Your function should take one string parameter Your function should return the number of m, n, o, ... z characters as an integer Your function should not...
Write a function that takes a string as a parameter and returns a new string that is the reverse of the old string. Python from test import testEqual def reverse(s): return s testEqual(reverse("hello"),"olleh") testEqual(reverse("l"),"l") testEqual(reverse("follow"),"wollof") testEqual(reverse(""),"")
In the function below, return the string 'negative' if the numeric parameter number is in fact negative, or, return the string 'positive' if the parameter number is positive, otherwise return string 'zero' use function "def string_indicating_positivityOrNegativity(number):" python 3
(7) Implement the shorten_space() function. shorten_space() has a string parameter and updates the string by replacing all sequences of 2 or more spaces with a single space. shorten_space() returns the string. Call shorten_space() in the print_menu() function, and then output the edited string. Hint: Look up and use Python function .isspace(). Ex: Edited text: we'll continue our quest in space. there will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space....
Write a recursive function, take a String as input, return true, if the String is a palindrome; false otherwise. For instance, if the input is: “A nut for a jar of tuna” Then the return value is true. Notice that the non English letters are ignored; the spaces are ignored; and it is NOT case sensitive. You must write recursive function. You shall turn in a complete program, including main function to use your function to test if a String...