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
What are the third generation of computer?​
balu736 [363]

The period of third generation was from 1965-1971. The computers of third generation used Integrated Circuits (ICs) in place of transistors. A single IC has many transistors, resistors, and capacitors along with the associated circuitry. The IC was invented by Jack Kilby.

3 0
3 years ago
Read 2 more answers
Which of the following components helps to limit the front-to-back movement of the crankshaft? 
iris [78.8K]
The correct answer is A. The thrust bearing

It is used to help limit the front-to-back movement of the crankshaft.
5 0
3 years ago
Read 2 more answers
(True/False). In an "ID" column with the data type INTEGER PRIMARY KEY, each value entered for the ID must be unique.
musickatia [10]

Answer:

The answer is "True".

Explanation:

  • The key to a relational database that is unique for each data record is a primary key, also called a primary keyword.
  • This unique identifier, including a driver's license name, telephone number, or vehicle identification number. This is an identifier (VIN).
  • There must always be the only primary key in such a relational database.
  • This is a specific relational database field (or column combination) that identifies each table entry in a unique way.
  • It utilized it to swiftly analyze the data within the table as a unique identifier.
5 0
3 years ago
What is the purpose of the domain name? The domain name is an example of a service provider. The domain name .gov.nz is an examp
malfutka [58]

.gov.nz is for New Zealand

6 0
3 years ago
Read 2 more answers
Which software development team member would make the most use of the tool, Load Runner?
sveta [45]
Given that Loadrunner is a software testing tool, I'm assuming that the software development team member who would make the most use of that tool is A. a software engineer, because that is the person who creates software and then tests it. 
4 0
3 years ago
Other questions:
  • are designed to locate information based on the nature and meaning of Web content, not simple keyword matches Select one: a. Cra
    14·1 answer
  • 1. compression
    11·1 answer
  • Using the Vigenere cipher, does the length of the key matter?
    8·1 answer
  • Which best describes obliteration in a forged document?
    11·1 answer
  • A program called a ( n ) ____ translates instructions written in high-level languages into machine code.
    13·1 answer
  • 3.1.5 Which network component connects a device to transmission media and allows the device to send and receive messages?
    6·1 answer
  • How do you insert a table by using standard toolbar?​
    13·1 answer
  • What is the top anime shows? &lt;3
    14·2 answers
  • Write a program that reads numbers from the user until a blank line is entered. Your
    15·1 answer
  • What should you do if a headset plugged into your computer is not working properly.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!