6 kyu

String Evaluation

241 of 494sataman

Description:

Evaluate the given string with the given conditons.

The conditions will be passed in an array and will be formatted like this:

{symbol or digit}{comparison operator}{symbol or digit}

Return the results in an array.

The characters in the conditions will always be in the string. Characters in the string are chosen from ascii letters + @#$%^&*()_{}[]

Example

input string: "aab#HcCcc##l#"
conditions: ["a<b", "#==4", "c>=C", "H!=a"]

The conditions in this example array can be interpreted as:

  • "a<b": The number of times "a" occurs in the string should be less than the number of times "b" occurs in the string
  • "#==4": "#" should occur exactly 4 times in the string
  • "c>=C": "c" should occur greater than or equal to the number of times "C" occurs
  • "H!=a": The number of times "H" occurs should not equal the number of times "a" occurs

In this example condition 1 is false and 2, 3, 4 are true. So the return value will be an array as such:

[False, True, True, True]
Strings
Algorithms

More By Author:

Check out these other kata created by sataman

Stats:

CreatedOct 5, 2016
PublishedOct 5, 2016
Warriors Trained946
Total Skips30
Total Code Submissions3855
Total Times Completed494
Python Completions241
JavaScript Completions268
Total Stars27
% of votes with a positive feedback rating91% of 150
Total "Very Satisfied" Votes127
Total "Somewhat Satisfied" Votes18
Total "Not Satisfied" Votes5
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • sataman Avatar
  • anter69 Avatar
  • JohanWiltink Avatar
  • Blind4Basics Avatar
  • KenKamau Avatar
  • saudiGuy Avatar
Ad