Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please check the similarity of the code and modify the code so that it doesn't get similarity. However, the example value should be correct. Example

Please check the similarity of the code and modify the code so that it doesn't get similarity. However, the example value should be correct.
Example data
Sample Input:
1234
1000000003
asdf
ProjectNo2
ElectricalEngineeringProgramming
Sample Output:
4
2
3
3
6
#include iostream
#include string
using namespace std;
int value(char word){
if (isdigit(word))
{
return word -'0';
}
else if (islower(word))
{
return 10+(word -'a');
}
else if (isupper(word))
{
return 36+(word -'A');
}
else {return -1;}
}
int longestSIS(string input){
int length = input.length();
int* ad = new int[length];
int MAX =1;
ad[0]=1;
for (int i =1; i length; ++i){
ad[i]=1;
for (int j =0; j i; ++j){
if (value(input[j]) value(input[i]) && ad[j]+1> ad[i])
{
ad[i]= ad[j]+1;
}
}
if (ad[i]> MAX){
MAX = ad[i];
}
}
return MAX;
}
int main(){
string input;
cin >> input;
int result = longestSIS(input);
cout result endl;
return 0;
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

1. Let a, b R, a Answered: 1 week ago

Answered: 1 week ago