# Introduction

OnePlus is a Chinese smartphone manufacturer founded in December 2013. Their latest phone, OnePlus 5, was unveiled on June 20, 2017.

I am sure you have seen that the name of the phone can easily be translated to a sum.

OnePlus can be written like 1+ thus OnePlus 2 = (1+ 2) = 3

# Input

The name of one OnePlus phone. The above list in the only possible input

OnePlus 1
OnePlus 2
OnePlus X
OnePlus 3
OnePlus 3T
OnePlus 5


# Output

The sum of the name (a number not a string)

OnePlus 1 => 2
OnePlus 2 => 3
OnePlus X => an integer
OnePlus 3 => 4
OnePlus 3T => 27 (T = Today = 23 thus 1+3+23=27)
OnePlus 5 => 6


# Rules

The input can be written in different versions. This applies to every names. For example

OnePlus 1
OnePlus1
One+ 1
One+1
1+ 1
1+1

• The output for OnePlus X is an integer that should be different from the other phones names. Whatever you want except 2,3,4,27,6
• The T in OnePlus 3T will always be 23 which is the day I am posting this.
• This is , so the shortest solution (in bytes) wins.
• Is One case-sensitive? What about inputs like One + 1(arbitrary number of spaces between the tokens)? – officialaimm Jun 23 '17 at 7:46
• Do we have to support all different versions? – Erik the Outgolfer Jun 23 '17 at 7:51
• @officialaimm One and Plus are case-sensitive. You only have to rely to the provided format – Weedoze Jun 23 '17 at 8:28
• Can the being considered advertisement? Or Spam? – sergiol Jun 23 '17 at 9:29
• @sergiol I am not linked. Sorry for the bad English hehe – Weedoze Jun 23 '17 at 9:47

# 05AB1E, 10 bytes

0Uθ.VT26:>


Try it online!

θ has been replaced by ®è on TIO since it hasn't been pulled there yet. Alternatively, ¤ would work too.

Explanation:

0Uθ.VT26:> "Accepts a single line from STDIN"\
0          "Push 0"\
U         "Assign to X"\
θ        "(implicit input)"\ "Take the last element"\
.V      "Eval as 05AB1E code"\
T     "Push 10"\
26   "Push 26"\
:  "Infinitely replace"\
> "Increment"\

• Though the question is not so clear, in your solution, OnePlus 4T is outputting same as OnePlus 3T – officialaimm Jun 23 '17 at 8:04
• @officialaimm I don't think we'll ever get such input. – Erik the Outgolfer Jun 23 '17 at 8:07

# Retina, 26 16 bytes

-10 bytes thanks to @MartinEnder

O
1
T
995
.
$* 1  Try it online! • The best way to write a test suite is to put %(G in the header, which simply applies the program to each line individually. You can shorten \D\n\n\d to . and the final stage to a simple 1: tio.run/##K0otycxL/K@q4Z7w35/LkCuEy9LSlEuPS0WLy/D/f/… – Martin Ender Jun 23 '17 at 8:16 • @MartinEnder thanks a lot. – ovs Jun 23 '17 at 8:26 # Perl 5, 21 bytes 20 bytes of code + -p flag. $_=/\d$/?$&+1:27*/T/


Try it online!

If the input ends with an integer (/\d$/), then we add one to it ($&+1) and outputs it. Otherwise, we output 27*/T/ which is 27 if the inputs contains a T, and 0 otherwise.

# C# (.NET Core), 138 bytes

using System.Linq;s=>s.Replace("One","1").Replace("Plus","+").Replace("T","+23").Replace("X","9").Split('+').Select(e=>int.Parse(e)).Sum()


Try it online!

• It's a lot shorter to just check the last character of the input. Is it a digit: output that digit + 1; is it T: output 27; else / is it X: output an unique digit like 0 or 9. – Kevin Cruijssen Jun 23 '17 at 13:10

# Java 8, 79 61 bytes

s->{int x=s.charAt(s.length()-1);return x<58?x-47:x<85?27:9;}


Explanation:

Try it here with all possible test cases.

s->{                             // Method with String parameter and integer return-type
int x=s.charAt(s.length()-1);  //  Get the last characters of the input
return x<58?                   //  If it's a digit:
x-47                   //   Return that digit + 1
:x<85?                  //  Else if it's a 'T':
27                     //   Return 27
:                       //  Else (it's a 'X')
9;                     //   Return 9 (unique digit other than 2,3,4,6,27)
}                                // End of method


# C (gcc), 6563 48 bytes

f(char*s){s+=strlen(s)-1;s=*s?*s^84?*s-47:27:9;}


Try it online!

# Excel VBA, 87 51 bytes

Anonymous VBE immediate window function that takes input from cell [A1] and outputs OnePlus math to the VBE immediate window

i=Asc(Right([A1],1)):?IIf(i<58,i-47,IIf(i<85,27,9))


## Old Version

Anonymous VBE immediate window function that takes input from cell [A1] that and outputs OnePlus math to the VBE immediate window

?Application.Evaluate("="&Replace(Replace(Replace([A1],"One",1),"Plus","+"),"T","+23"))


### Input/Output

As a result of the Application.Evaluate call this solution is afforded access to all of the Excel WorkSheet Functions

[A1]="OnePlus 3T"
?Application.Evaluate("="&Replace(Replace(Replace([A1],"One",1),"Plus","+"),"T","+23"))
23

[A1]="OnePlusPi()"
?Application.Evaluate("="&Replace(Replace(Replace([A1],"One",1),"Plus","+"),"T","+23"))
4.14159265358979

[A1]="One+Day(Now())"
?Application.Evaluate("="&Replace(Replace(Replace([A1],"One",1),"Plus","+"),"T","+23"))
26
`