Answer:
def is_dual( array):
if len(array) % 2 == 0:
count = 0
for i in range(0, len(array)//2, 2):
if array[i] + array[i+1] == array[0] + array[1]:
count += 1
if count == len(array)//2:
return True
else:
return False
Explanation:
The python program defines a function called is_dual that accepts an array parameter and check if the array is dual. If it meets the condition, the function returns true but returns false when the array is not dual.
Answer:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string st;
getline(cin,st);
int i=0;
while(i<st.length())
{
if(isupper(st[i]))
{
st.erase(st.begin()+i);
continue;
}
i++;
}
cout<<st<<endl;
return 0;
}
Explanation:
I have included the file bits/stdc++.h which include almost most of the header files necessary.
For taking the input as a string line getline is used.
For checking the upper case isupper() function is used. cctype header file contains this function.
For deleting the character erase function is used.
Internet explorer is a web browser