Problem:
Score : 100 points

Problem Statement

You have three tasks, all of which need to be completed.

First, you can complete any one task at cost 0.

Then, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.

Here, |x| denotes the absolute value of x.

Find the minimum total cost required to complete all the task.

Constraints

All values in input are integers.

1 \leq A_1, A_2, A_3 \leq 100

Input

Input is given from Standard Input in the following format:

A_1 A_2 A_3

Output

Print the minimum total cost required to complete all the task.

Sample Input 1

1 6 3

Sample Output 1

5

When the tasks are completed in the following order, the total cost will be 5, which is the minimum:

Complete the first task at cost 0.

Complete the third task at cost 2.

Complete the second task at cost 3.

Sample Input 2

11 5 5

Sample Output 2

6

Sample Input 3

100 100 100

Sample Output 3

0

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
//Problem Code

#define TC int t; cin>>t; while(t--)
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, st, en, in) for (int i=st ; i<en ; i+=in)
#define RFOR(i, st, en, in) for (int i=st ; i>=en ; i-=in)
#define REP(i, n) FOR(i, 0, n, 1)
#define RREP(i, n) RFOR(i, n-1, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define sz(a) int(a.size())
#define SORT(c) sort(all(c))
#define RSORT(c) sort(rall(c))

using namespace std;
using ull = unsigned long long int;
using ll = long long;
using pii = pair<int,int>;

ll gcd( ll a, ll b){
	if(a==0)
		return b;
	else
		return gcd(b%a,b);
}

ll bs(ll s,ll e,ll a[],ll v){
    ll m =(s+e)/2;
    if(v>a[m]) return bs(m+1,e,a,v);
    else if(v<a[m]) return bs(s,m-1,a,v);
    return m;
}

void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

void testingio(){
	freopen("input.txt","r",stdin); //redirects standard input
    freopen("output.txt","w",stdout); //redirects standard output	
}

int main(){
	//testingio();
	fastio();
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int tot = 0,c=0,max_c=0;
    int i=0,j=0;
    while(tot<2*n){
        if(i==n)  i=0;
        if(j==n)  j=0;
        if(s[i]==t[j]) {
            c++;
            i++;
            j++;
            max_c=max(max_c,c);
        }        
        else {
            c=0;
            i++;
       }
       tot++;
    }
    if(max_c>=n) cout<<"Yes";
    else cout<<"No";    
	return 0;
}