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
The area of a square is stored in a double variable named area. write an expression whose value is length of the diagonal of the
ale4655 [162]
You should specify what language you're using in these types of questions; here's an example in C++.

#include <iostream>
#include <math>

int main()
{
// example area
double area = 25;

// square root the area to find the length
// then apply basic pythagoras
double diagonal = sqrt(pow(sqrt(area), 2) + pow(sqrt(area), 2));

return 0;
}
8 0
3 years ago
How is knowing how to use word or docs importamt?
ollegr [7]
For 90% of users, the word processing capabilities of Google Docs is more than enough. But for some, Microsoft Word's advanced features will be important. ... You also get far more powerful templates, which could speed up your work, depending on what you use Word for.
3 0
2 years ago
What is a browser? Give one example
Harman [31]
It is a program that may be used by a user to access files and navigate the World Wide Web. An example of this would be Firefox, Chrome, Safari, etc.
3 0
3 years ago
Read 2 more answers
Whenever I ask a question I loose points I just asked a question before and I had 56 points now I have 12 now I'll probably have
lilavasa [31]
Just try to answer some questions as well, then you can keep a nice balance.
ps. Only answer the questions you know. 
5 0
3 years ago
A customer dictates instruction on how to transcribe audio. Do you have to transcribe the instruction word for word?
Ostrovityanka [42]

Answer:

No

Explanation:

4 0
2 years ago
Other questions:
  • He would like to get rid of the graph. What will accomplish
    8·1 answer
  • A matrix representation stores matrices such that the offset address of the element in row i and column j can be calculated by c
    12·1 answer
  • Which online resource is usually not free?
    10·2 answers
  • You are informed that all the users within the network are unable to access the Internet. You decide to start troubleshooting fr
    12·1 answer
  • E-mail has made it very easy to send a message to more than one person at any time of day from just about anywhere. If you wante
    12·2 answers
  • Alison retrieved data from a company database containing personal information on customers. When she looks at the SSN field, she
    14·1 answer
  • What area on the Microsoft® Publisher® application screen shows the name of the publication?
    9·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    12·2 answers
  • What your favorite video game? (Put your user if you wanna play!)
    9·2 answers
  • How much do you think it would cost to develop an app?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!