Skip to main content

Programming Assignment-1: Holes


Let us assume paper as the plane and a letter as a curve on the plane, then each letter divides the plane into regions. For example letters "A", "D", "O", "P", "R" divide the plane into two regions so we say these letters each have one hole. Similarly, letter "B" has two holes and letters such as "C", "E", "F", "K" have no holes. We say that the number of holes in the text is equal to the total number of holes in the letters of the text. Write a program to determine how many holes are in a given text.

Input Format:
The only line contains a non-empty text composed only of uppercase letters of English alphabet.
Output Format:
output a single line containing the number of holes in the corresponding text.
Example-1

Input:


DRINKEATCODE

Output:

5

Explanation:

D R A O D has one hole hence total number of holes in the text is 5.

Source Code

ip=input()
c=0
H1=["A", "D", "O", "P", "R",'Q']
H0=['C','E','F','G','H','I','J','K','L','M','N','S','T','U','V','W','X','Y',"Z"]
for i in ip:
    if i in H1:
        c+=1
    elif i in H0:
        pass
    else:
        c+=2
print(c,end='') 

Comments

Popular posts from this blog

Know about Fuchsia OS

Fuchsia is a capability-based operating system currently being developed by Google. It first became known to the public when the project appeared on GitHub in August 2016 without any official announcement. In contrast to prior Google-developed operating systems such as Chrome OS and Android, which are based on the Linux Kernel, Fuchsia is based on a new microkernel called "Zircon". The GitHub project suggests Fuchsia can run on many platforms, from embedded systems to smartphones, tablets, and personal computers. In May 2017, Fuchsia was updated with a user interface, along with a developer writing that the project was not a "dumping ground of a dead thing", prompting media speculation about Google's intentions with the operating system, including the possibility of it replacing Android. Fuchsia is also a future based operating system,it will be grow or famous than android operating system and vice versa. Fuchsia OS is written by C,C++,Go,Rust,

10 Best Smart phone under 10,000 range in 2020.

If you are looking best smart phone in 2020 under 10,000 budget but you don't know which smart phone will be the best for yours , then I suggest to you 10 best smartphone, which will be the best for you. Hi this is Santanu From Tech Pathsala . You are reading Tech Pathsala blog. Without  wasting more time lets get started. 1.  Realme C11 (Rich Green, 32 GB) (2 GB RAM) Realme C11 Technical Details: OS Android RAM 2 GB Item Weight 195 g Product Dimensions 16.4 x 7.6 x 0.9 cm Batteries: 1 Lithium ion batteries required. (included) Item model number RBSOC1102IN Connectivity technologies 4G Special features 2 GB RAM | 32 GB ROM | Expandable Upto 256 GB, 16.51 cm (6.5 inch) HD+ Display, 13MP + 2MP | 5MP Front Camera, 5000 mAh Battery, Mediatek Helio G35 Processor Other camera features 13MP + 2MP Rear Camera Setup, Sensor Sizes/Pixel Data: 13MP (1/3 inch, 1.12um), 2MP (1/5 inch, 1.75um), CMOS Sensor, Focusing Method: PDAF/AF (13MP), FF (2MP), 4X Maximum Zo

Make Money Online Using Quora Marketing Is So Famous, But Why?

You don't have any online skills, don't have money, don't have website also don't have any products nothing. But you want to start online business today.  Can you still make money online? The short answer is YES. In this article I will tell you how to make money online without money, website or products.  You don't need any website, you don't  need any budget, you don't need any online skills, you just need to follow me and read the article. I will tell you exactly strategy how to make money online,  even from the first month. So stay tuned, make patience and follow me.  Hi this is Santanu from Tech Pathsala. You are reading Tech Pathsala blog. So without wasting more time let's get started. Simply whenever you want to make money online or even offline the main strategy is selling a products. So that's simple, we have a product and we have an  audience that love to buy this product. So you can sell them this product, that's simple.  Now main prob