Afghanistan has surrounded by attackers. A truck enters the city. The driver claims the load is food and medicine from Pakistanis. Yasir is one of the soldier in Afghanistan. He doubts about the truck, maybe it’s from the siege.
He knows that a tag is valid if the sum of every two consecutive digits of it is even and its letter is not a vowel.
If the tag is invalid then Yasir need to arrest the driver of the truck with invalid tab. If it is valid the truck is allowed inside the country.
Can you help yasir in determine if he need to arrest or allow the truck?
Input: 12E345-67
The first line contains a string. And the format is "DDXDDD-DD", where D stands for a digit (non zero) and X is an uppercase english letter.
Output: Arrest
Print "Allowed" if the tag is valid, print "Arrest" otherwise.
#include <stdio.h> #include <string.h> int main() {char tag[9];scanf("%s",tag); int i=0,flag=0,c=0; for(i=0;i<strlen(tag);i++){ if(i==6){ continue;} else if(i==2){flag=(tag[i]=='A'||tag[i]=='E'||tag[i]=='I'||tag[i]=='O'||tag[i]=='U');} else{c=c + tag[i]-'0';}} if(c%2==0 && flag==0) {printf("Allowed");} else{printf("Arrest");} return 0; }
INPUT_1:
12E345-67
OUTPUT:
Arrest
INPUT_2:
11B242-73
OUTPUT:
Allowed
INPUT_3:
55C333-55
OUTPUT:
Arrest
INPUT_4:
44Z333-12
OUTPUT:
Allowed
ILLUSTRATION
Morae! Q
- Find a triplet such that triplet is minimum of all the triplets.
- Rearrange characters in a string such that no two adjacent are same.
- Return the coordinates of all cells in matrix sorted by their distance.
- Function to verify the ISBN number from the book.
- Find out the absolute difference of values of two array integers.
- Rotate the array in the right direction by K steps.
- Find the sequence of moves that wins the game, collect exactly G coins!.
- Calculate the sum of boundary elements of a matrix.
- Find the total number of ways to reach the tree house.
- Compute profit and loss of a product.
- Find the total expense of purchased items.
- Determine the maximum sequence weight.
- Find the person’s birth year is a leap year or not.
- Find the inner rating with the displayed rating.
- Find if angles are valid to form a triangle.
- Find out the winner of the game from the given statistics.
- Verify the tag to determine if one needs to arrest or allow the vehicle.
- Find the largest hexadecimal number.
- Group up all anagrams together from given words.
- Return all anagrams from the given words.