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
Anastaziya [24]
1 year ago
10

A string consisting of the letters a, b, c and d is given. the string can be transformed either by removing a letter a together

with an adjacent letter b or by removing a letter c together with an adjacent letter d. write a function so that the given string s consisting of n characters returns any string
Computers and Technology
1 answer:
Free_Kalibri [48]1 year ago
5 0

Using the knowledge in computational language in C++ it is possible to write a code that write a function so that the given string s consisting of n characters returns any string

<h3>Writting in C++ code:</h3>

<em>#include <iostream></em>

<em>#include <string></em>

<em>using namespace std;</em>

<em>string solution(string &s)</em>

<em>{</em>

<em>//length of string</em>

<em>int n=s.size();</em>

<em>//index of string</em>

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

<em>while(i<n-1)</em>

<em>{</em>

<em>if(s[i]=='A')</em>

<em>{</em>

<em>if(s[i+1]=='B')</em>

<em>{</em>

<em>s=s.substr(0,i) + s.substr(i+2); i=0;</em>

<em>}</em>

<em>else</em>

<em>i++;</em>

<em>}</em>

<em>else if(s[i]=='B')</em>

<em>{</em>

<em>if(s[i+1]=='A')</em>

<em>{</em>

<em>s=s.substr(0,i) + s.substr(i+2); i=0;</em>

<em>}</em>

<em>else</em>

<em>i++;</em>

<em>}</em>

<em>else if(s[i]=='C')</em>

<em>{</em>

<em>if(s[i+1]=='D')</em>

<em>{</em>

<em>s=s.substr(0,i) + s.substr(i+2);</em>

<em>i=0;</em>

<em>}</em>

<em>else</em>

<em>i++;</em>

<em>}</em>

<em>else if(s[i]=='D')</em>

<em>{</em>

<em>if(s[i+1]=='C')</em>

<em>{</em>

<em>s=s.substr(0,i) + s.substr(i+2);</em>

<em>i=0;</em>

<em>} else</em>

<em>i++;</em>

<em>}</em>

<em>n=s.size();</em>

<em>}</em>

<em>return s;</em>

<em>}</em>

<em>int main() {</em>

<em>//Input string</em>

<em>string s="ACBDACBD";</em>

<em>solution(s);</em>

<em>//final output;</em>

<em>if(s=="")</em>

<em>cout<<"Empty String";</em>

<em>else</em>

<em>cout<<s;</em>

<em>return 0;</em>

<em>}</em>

See more about C++ code at brainly.com/question/19705654

#SPJ1

You might be interested in
Suppose there is a text file named "datafile.txt with some data in the root directory of your computer". Using your choice of la
aivan3 [116]

Answer:

See explaination for program code

Explanation:

code below

using System;

using System.IO;

namespace ReadAndDisplayFileCOnsole

{

class Program

{

static void Main(string[] args)

{

using (StreamReader reader = new StreamReader("D:\\datafile.txt"))

{

while (true)

{

string line = reader.ReadLine();

if (line == null)

{

break;

}

Console.WriteLine(line);

}

reader.Close();

Console.Read();

}

}

}

}

6 0
3 years ago
The ________ Web, originally envisioned by Tim Berners-Lee, one of the founders of the Internet, is a set of design principles t
shusha [124]

Answer:

The answer is "Semantic".

Explanation:

It can be designed as an enhanced country-wide mobile version and represents a useful way to view the information as a globally connected database.

  • It is the network of information, that can be linked and processed effectively by machines instead of by human workers.
  • It is one of the creation of the Web, which is originally imagined a series of concepts, that allowed machines to better index websites, issues, and subjects.
4 0
3 years ago
How can you create a safe and secure password? Choose a password unassociated with your personal history. Choose the same passwo
Simora [160]

Answer:

sudoors787389

Explanation:

in other to get more secured password a combination of password like this will be more secured (sudoors787389)

8 0
3 years ago
As which printers are ink-jet printers or band printers classified?
Anestetic [448]
I think character printers
5 0
4 years ago
How many computers/laptop's suported windows 10 pro with a game in vr?
Papessa [141]

REQUIREMENTS NEEDED FOR COMPUTERS TO SUPPORT VR

Today, there are a wide variety of VR systems available to the average consumer. Virtual reality offers an immersive experience for hardcore gaming enthusiasts, but your PC might require updates in order to support your VR system. VR compatibility will depend on the specifications of your CPU, GPU, RAM, hard drive, and other core components. In this informative guide, we dive deep into some of the most popular VR systems on the market, as well as system requirements provided by the manufacturers of Oculus Rift and HTC Vive VR headsets. With our help and the right components, you can prepare your desktop or laptop computer for the rich visuals of virtual reality gaming.

PC REQUIREMENTS NEEDED TO SUPPORT VR

Whether you’re in the market for a new PC, building a high-end rig for gaming, or upgrading your PC to virtual reality standards, the hardware requirements of your VR system are essential to achieving the ultimate VR experience. The official requirements and hardware demands will vary from Oculus to Vive systems.

OFFICIAL OCULUS RIFT RECOMMENDATIONS

With a PC built to official recommendations, you can play almost any game on maximum settings on a standard 1080p monitor. These specifications ensure that developers can optimize for a known hardware configuration.

CPU: Intel Core i3-8100

GPU: RX 570 (or GTX 1060 3GB)

Motherboard: ASRock Z370 Pro4

Storage 1: Seagate Barracuda 1TB HDD

Storage 2: None (or Crucial MX500 250GB SSD)

Power Supply: Seasonic S12II 620

RAM: 8GB DDR4

Case: Corsair 200R

CPU Cooler: Stock (or Deepcool Gammaxx 400)

Operating System: Windows 10

Official HTC Vive Recommendations

GPU: Nvidia GeForce GTX 970 or AMD Radeon R9 290 equivalent

CPU: Intel i5-4590 or AMD FX 8350 equivalent

RAM: 4 GB or more

Video Output: HDMI 1.4, DisplayPort 1.2 or newer

USB Port: 1x USB 2.0 or better port

Operating System: Windows 7 SP1, Windows 8.1 or later, Windows 10

RELIABLE BUILD FOR VR GAMING

There’s no need to spend a large amount of money to play games with reasonable detail and high frame rates. With case, motherboard, power supply, and solid state drive updates, you can get a great value and better performance.

CPU: AMD Ryzen 5 1600

GPU: GeForce GTX 1070

Motherboard: MSI B350M Gaming Pro

Storage 1: Crucial MX500 250GB SSD

Storage 2: Seagate Barracuda 2TB HDD

Power Supply: EVGA GQ 650W

RAM: 16GB DDR4

Case: Corsair Carbide 270R

CPU Cooler: Stock

Operating System: Windows 10

HARDCORE BUILD FOR VR GAMING

Prepare your PC for VR games that haven’t even hit the market yet and achieve 90 FPS in any game made for Rift or Vive, all while staying within a budget of $2,000 or less.

CPU: AMD Ryzen 5 1600X

GPU: GTX 1080

Motherboard: MSI B350 PC Mate

Storage 1: Crucial MX500 500GB SSD

Storage 2: Seagate Barracuda 2TB HDD

Power Supply: EVGA 850 G2

RAM: 16GB DDR4

Case: Corsair Crystal 460X or Enthoo Pro

CPU Cooler: Noctua NH-U12S SE-AM4

Operating System: Windows 10

4 0
3 years ago
Read 2 more answers
Other questions:
  • Write a function solution that returns an arbitrary integer which is greater than n.
    13·1 answer
  • The _______ dialog box displays formatting tabs for Font, Number, and Alignment
    9·1 answer
  • Respond to the following in three to five sentences. Select the workplace skill, habit, or attitude described in this chapter (a
    12·1 answer
  • The source ip address is 164.109.28.3 subnet mask of 255.255.128.0 network address is
    7·1 answer
  • Uugurfofyhjfsjvrdjctstghfjddd
    13·1 answer
  • For this lab, youhave to write a programnamedseriesFunction.cthat prompts user to enter two values, x and n. Then it would use a
    11·1 answer
  • a.Write a Python function sum_1k(M) that returns the sumí‘ í‘ = ∑1푘푘푀푀푘푘=1b.Compute s for M = 3 by hand and write
    15·1 answer
  • What should you do to help prepare yourself for the delivery of your presentation? you can chose more then one
    8·1 answer
  • Write a function named repeat_words that takes two string parameters: 1. in_file: the name of an input file that exists before r
    13·1 answer
  • Use the drop-down menus to complete statements about back-up data files.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!