Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $n = intval(readline());
- $nueArr = [];
- for ($i = 0; $i < $n; $i++) {
- $args = explode(" ", readline());
- $name = $args[0];
- $type = $args[2];
- if ($type === "going!") {
- if (isset($name, $args)) {
- if (!in_array($name, $nueArr)) {
- $nueArr[] = $name;
- } else {
- echo "$name is already in the list!" . PHP_EOL;
- }
- }
- }
- if ($type === "not") {
- if (!in_array($name, $nueArr)) {
- echo "$name is not in the list!" . PHP_EOL;
- }
- if (in_array($name, $nueArr)){
- $index = array_search( $name,$nueArr);
- array_splice($nueArr,$index,1);
- }
- }
- }
- for ($i = 0; $i < count($nueArr); $i++) {
- echo $nueArr[$i] . PHP_EOL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement