You are on page 1of 2

// You are using Java

import java.io.*;
import java.util.*;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
class CreateFile
{
public static void main(String[] args) throws IOException
{
// Type your code here
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
try
{
BufferedWriter bw=new BufferedWriter(new FileWriter("Hello.txt"));
bw.write(s);
bw.close();

BufferedReader br=new BufferedReader(new FileReader("Hello.txt"));


// System.out.print(br.read());
String s1=br.readLine();
// System.out.print(s1);
char[] c=s1.toCharArray();
/* while(s1!=null)
{
System.out.println(s1);
}*/
int scount=0;
int secount=0;
char j=' ';
for(char i:c)
{
if(i==' ')
scount++;
if(i=='.')
secount++;
j=i;
}
// int len=c.length;

//System.out.print(len);
if(Character.isAlphabetic(j))
secount++;
System.out.println((scount+1)+" "+(secount));
}
catch(IOException e)
{
System.out.println(e);
}
}

You might also like