SHARE
TWEET

Rage Quit

MartinGeorgiev Jul 10th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $string = readline();
  4. $countUniqueSymbols = 0;
  5. $stringCountRepeat = 0;
  6. $tempString = '';
  7. $newString = '';
  8. for ($i = 0; $i < strlen($string); $i++) {
  9.     $currentChar = $string[$i];
  10.     if (is_numeric($currentChar) !== true) {
  11.         $tempString .= $currentChar;
  12.     } else {
  13.         if ($i + 1 < strlen($string)) {
  14.             $nextChar = $string[$i + 1];
  15.             if (is_numeric($nextChar)) {
  16.                 $currentChar .= $nextChar;
  17.             }
  18.         }
  19.         $stringCountRepeat = intval($currentChar);
  20.         $newString .= str_repeat(strtoupper($tempString), $stringCountRepeat);
  21.         $tempString = '';
  22.     }
  23. }
  24. $rageMessage = array_unique(str_split($newString));
  25. echo "Unique symbols used: " . count($rageMessage) . PHP_EOL;
  26. echo $newString;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top