import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	}
} import java.util.*; util.* java public class Main
{
	public static void main(String[] args) {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	}
} Main public static void main(String[] args) {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	} main {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	} Scanner si=new Scanner(System.in); si new Scanner(System.in) String str; str str=si.next() str si.next() si.next si char ch[]=str.toCharArray(); ch str.toCharArray() str.toCharArray str int n=str.length() n str.length() str.length str count=1; count 1 for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0; int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0; if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0; ch[i]=='R' && ch[i+1]=='R' ch[i]=='R' ch[i] ch i 'R' ch[i+1]=='R' ch[i+1] ch i+1 i 1 'R' count++ count if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0; ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1 ch[0]=='R'&& count==1 ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1 ch[0]=='R' && ch[2]=='R' && count==1 ch[0]=='R' && ch[2]=='R' && count==1 ch[0]=='R' ch[0] ch 0 'R' ch[2]=='R' ch[2] ch 2 'R' count==1 count 1 ch[1]=='R' && ch[2]=='S' && count==1 ch[1]=='R' && ch[2]=='S' && count==1 ch[1]=='R' ch[1] ch 1 'R' ch[2]=='S' ch[2] ch 2 'S' count==1 count 1 ch[0]=='R'&& count==1 ch[0]=='R' ch[0] ch 0 'R' count==1 count 1 ch[2]=='R'&& count==1 ch[2]=='R' ch[2] ch 2 'R' count==1 count 1 count=1 count 1 if(ch[i]!='R' && count==1)
		        count=0; ch[i]!='R' && count==1 ch[i]!='R' ch[i] ch i 'R' count==1 count 1 count=0 count 0 System.out.println(count) System.out.println System.out System System.out count si.close() si.close si String[] args args public class Main
{
	public static void main(String[] args) {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	}
} public class Main
{
	public static void main(String[] args) {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	}
} Main
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner si=new Scanner(System.in);
		String str;
		
		str=si.next();
		
		char ch[]=str.toCharArray();
		
		int n=str.length(),count=1;
		
		for(int i=0;i<n-1;i++)
		    if(ch[i]=='R' && ch[i+1]=='R')
		        count++;
		    else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
		        count=1;
		    else if(ch[i]!='R' && count==1)
		        count=0;
		
		System.out.println(count);
		si.close();
	}
}
