1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alenkasestr [34]
3 years ago
8

Count input length without spaces, periods, or commas Given a line of text as input, output the number of characters excluding s

paces, periods, or commas. You may assume that the input string will not exceed 50 characters.
Ex: If the input is:
Listen, Mr. Jones, calm down.
the output is:
21
Note: Account for all characters that aren't spaces, periods, or commas (Ex: "r", "2", "!").
Can I get this in C programming please?
Computers and Technology
2 answers:
MrRa [10]3 years ago
6 0

Answer:

This program is implemented in C++ using dev C++.  The solution of this answer along with running code is given below in explanation section.

Explanation:

#include <iostream>

#include<string>

using namespace std;

int main()

{

   string str;

   

cout<<"Enter String \n";

 

getline(cin,str);/* getLine() function get the complete lines, however, if you are getting string without this function, you may lose date after space*/

 

   //cin>>str;

 

   int count = 0;// count the number of characeter

   for (int i = 1; i <= str.size(); i++)//go through one by one character

   {

     

   

    if ((str[i]!=32)&&(str[i]!=44)&&(str[i]!=46))//do not count  period, comma or space

 {

           ++ count;//count the number of character

       }

   }

   cout << "Number of characters are  = "; //display

cout << count;// total number of character in string.

   return 0;

}

}

Ivanshal [37]3 years ago
5 0

Answer:

user_text = input()

import re

string = ( "listen, Mr. Jones, calm down.")

print(len(re.sub(r'[,.\s]+', '', string)))

Explanation:

You might be interested in
An excel user should use a relative cell reference when it is important to ____. preserve the relationship to the formula locati
adell [148]

An excel user should use a relative cell reference when it is important to preserve the relationship to the formula location. When you create a formula that references other cells, excel does not normally "record" the exact cell address. Instead, it looks at the at the relationship that cell has to the other cell containing the formula.

7 0
3 years ago
What will be the value of ans after the following code has been executed?
Lesechka [4]

Answer:

Option B 120

Explanation:

There are three variables,<em> ans, x </em>and <em>y</em> given in the code. In beginning, the variable. <em>ans,</em> holds value of 10.  And variable <em>x</em> and <em>y</em> hold value of 65 and 55, respectively. Since the value held by x is bigger than one held by y, the if condition is met and the statement ans = x + y will run. The execution of this statement will total x with y -> 65 + 55 and the initial value of <em>ans is </em>overwritten by the addition result which is 120.

7 0
3 years ago
Read 2 more answers
The readline method of bufferedreader returns _____ when end of file is reached.
Misha Larkins [42]

Answer:

null

Explanation:

it does not turn to null value. It returns ;

when it reaches the end of the file

6 0
1 year ago
What is the formula equivalent to the function =SUM(B1:B5)? A. =B1+B5 B. =$B$1+$B$5 C. =B1+B2+B3+B4+B5 D. =$B$1+$B$2+$B$3+$B$4+$
Contact [7]

Given the options, I would choose Option C. =B1+B2+B3+B4+B5.

5 0
3 years ago
A(n) __________ DHCPv6 server relies on router advertisements to give some information to individual hosts, making small changes
vodomira [7]

Answer:

Stateless

Explanation:

According to my experience in the field of information technology and networking, I can say that the type of server being mentioned is a Stateless DHCPv6 server. This is a server that provides some information to individual hosts within the network, but does not make any address assignments to the individual devices. Like mentioned in the question.

8 0
3 years ago
Other questions:
  • Which loan type requires you to make loan payments while you’re attending school?
    9·1 answer
  • Janice, who is 15, posts a picture of herself drinking alcohol and making an obscene gesture on her social networking page. Whic
    11·2 answers
  • You wish to lift a 12,000 lb stone by a vertical distance of 15 ft. Unfortunately, you can only generate a maximum pushing force
    6·1 answer
  • In chapter 3, we discussed syntax and semantics, in general there are two types of grammars for programming languages, regular a
    14·1 answer
  • Find a 95% confidence interval for the mean failure pressure for this type of roof panel.The article "Wind-Uplift Capacity of Re
    7·1 answer
  • Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T
    15·1 answer
  • Why is it important to put the most specific case first? What types of errors does it help avoid?
    11·1 answer
  • Trong ửod muốn trình bày dạng cột càn thực hiện lệnh nào
    13·1 answer
  • PLEASE HELP
    12·1 answer
  • Array bounds checking should be directly coded into a system rather than assumed.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!