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
sesenic [268]
3 years ago
10

Given a line of text as input, output the number of characters excluding spaces, periods, or commas.

Computers and Technology
2 answers:
Flauer [41]3 years ago
7 0

Answer:

<em>import java.util.Scanner;</em>

<em>public class ANot {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner(System.in);</em>

<em>        System.out.println("Please enter a string of words");</em>

<em>        String n = in.nextLine();</em>

<em>        int count = 0;</em>

<em>        for (int i=0; i<n.length(); i++){</em>

<em>            if((n.charAt(i) != '.') &&(n.charAt(i) != ',') && (n.charAt(i) != ' ')){</em>

<em>                count++;</em>

<em>            }</em>

<em>        }</em>

<em>        System.out.println(count);</em>

<em>    }</em>

<em>}</em>

Explanation:

  1. Prompt User to input the string and assign to a variable
  2. SET count =0.
  3. Using a for loop iterate over the string
  4.  if((n.charAt(i) != '.') &&(n.charAt(i) != ',') && (n.charAt(i) != ' ')) then count =count +1.
  5.     PRINT count.

myrzilka [38]3 years ago
7 0

Answer:

user_text = input()

import re

str1= input("21 ")

pattern = '[a-zA-Z]'

count=0

i=0

while(i<=len(str1)-1):

  result = re.match(pattern, str1)

  if (result):

      count+=1

  else:

      continue

  i+=1

print("String Length:",count)

Explanation:

You might be interested in
How to boost audio live ​
Masteriza [31]
Huh


Hzhanajsjjajajans
6 0
3 years ago
ANSWER QUICKLY!
patriot [66]

Answer:

It is bit { measurement used to quantify computer data. }

7 0
3 years ago
What are color highlights?
SVETLANKA909090 [29]

A- overusing highlights lowers the contrast and degrads the effect of the highlights.

3 0
3 years ago
Read 2 more answers
Who here watches obx, Riverdale or on my block?
melomori [17]

Answer:

Riverdale i watch it!

Explanation:

3 0
2 years ago
Read 2 more answers
Which of the following statements is NOT a valid way to create a date object named birthday?
dem82 [27]

Answer:

var birthday = "12/2/1978";

Explanation:

It does not create a date object named birthday because in this statement the birthday is a string which contains 12/2/1978 a date it is not date object it is a string.All other three options are correct way to create a date object.

var birthday = new Date();

creates a date object with the current date and time.

we can also pass date string in the new Date().So var birthday = new Date("12/2/1978"); is also correct.

we can also pass year,month,day in new Date() In this order only.So option fourth is also correct.

4 0
3 years ago
Other questions:
  • Which of the following describes a hash algorithms ability to avoid the same output from two guessed inputs?A. Collision avoidan
    12·1 answer
  • You are a network administrator for a large bagel manufacturer that has 32 bakeries located throughout the United States, United
    6·1 answer
  • If you glare and grit your teeth while telling your friend that you're not frustrated, your nonverbal communication is _________
    6·1 answer
  • A(n) _____ is a request for the database management software to search the database for data that match criteria specified by th
    15·2 answers
  • Does clicking ads and pop ups like the one shown in this image could expose your computer to malware?
    15·1 answer
  • 1. Name the first PC virus.<br> 2. In which language are viruses written for Microsoft programs?
    8·2 answers
  • Custom actions help your users by
    6·1 answer
  • In the context of computer and network security, _____ means that a system must not allow the disclosing of information by anyon
    10·1 answer
  • ________ are the symbolic codes used in assembly language?​
    6·1 answer
  • List and briefly define the four main elements of a computer.​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!