A Compliance Problem (175 Points) : Input
A Compliance Problem (175 Points) : Input
Limit: 1024 MB
Time Limit: 5 s
Introduction
As part of a team project to build an instant messaging program, you have to work around your
teammate's buggy compliance filter.
The compliance filter works based on an algorithm which determines if certain messages can pass
through the system and if they should be flagged. Usually the compliance filter system has a dictionary
of black listed words which it filters out.
However, due to your teammate's programming error the compliance filter system appears to only allow
words that are palindromes or anagrams of palindromes (i.e. can make a palindrome when re-arranged).
For example:
abba
aabb (this one is an anagram of abba or baab)
civic
deified
mom
mmo
radar
While a fix is being worked on, you are tasked with writing an add on that will determine if a word can
pass through the this system.
Input Specifications
Your program will take
A string S denoting the word to be tested. All letters in the alphanumeric input will be lowercase
(1 LENGTH(S) 500), and there may be numbers and symbols.
Output Specifications
Based on the input,
Print out yes if the input would pass through the system
Print out no if the input would fail the system
Sample Input/Output
Input
abba
Output
yes
Explanation
abba is already a palindrome.
Input
nnmm
Output
yes
Explanation
While nnmm isn't a palndirome, it can be re-arranged to make one; nmmn and mnnm are palindromes
that can pass through the system.
Input
trail
Output
no
Explanation
trail isn't a palindrome, nor an anagram of a palindrome, and therefore will not pass through the system.
Memory Limit: 1350 MB
Time Limit: 3 s
Introduction
You are an entry level hero and your first task from the Lannisters of Justice is to break into the throne
room of the Mad Mathemagician. The only issue is that his throne is guarded by a numeric password that
is solved by following a specific ordering of operations on an expression.
No one before you was successful, but that was because they didn't figure out that the Mathemagician
followed his own Mad order of operations; he ordered it by the amount of strokes it took his iron pen to
write the operators. The ordering you have deduced (from first to last) is: subtraction( - ), division( / ),
addition( + ), multiplication( * )
Input Specifications
You will be given a single line of character input of no more than 100 characters that is a valid math
expression using integers and math operations. Example could be something as simple as 3+4 or
something a little more complex, such as 3*4+12/6. Your input will only contain the 4 operators and
numbers, no other characters.
Output Specifications
You will need to output the solution to the equation when applying the Mathemagician's order of
operations. All output will be a single integer value.
Sample Input/Output
Input
16-4*2
Output
24
Explanation
Subtraction happens before multiplication, so the calculation is 16-4 = 12, then 12 * 2 = 24, which is the
solution.
Input
2+3*24/6-2/3
Output
10
Explanation
First you take 6-2 = 4. Then, 24/4 = 6 and 6/3 = 2, so now the expression is 2+3*1. Addition is next, so
2+3=5, so you get 5*2 = 10