Skip to content

Commit

Permalink
Find number of small letter in a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Arijit-SE committed Mar 17, 2023
1 parent fef9eda commit 99c810b
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Count_LowerCase.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Find number of lower case
/* Find number of lower case in a string
* AriJIt = 3
*/

Expand All @@ -9,22 +9,32 @@ public static void main(String[]args)
int count = 0;
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
for (int i = 0; i < s.length(); i++)
{
if(Character.isLowerCase(s.charAt(i)))
{
count++;
}
}
/* Alternative Method using array creation
-----------------------------------------------------
char[] arr;
arr = s.toCharArray();
/* Other process to create character array
******************************************
for(int i=0; i<s.length(); i++)
{
arr[i] = s.charAt(i);
}
*/
// Other process to create character array
| ******************************************
| for(int i=0; i<s.length(); i++)
| {
| arr[i] = s.charAt(i);
| }
//
for(int i=0; i<arr.length;i++)
{
if(Character.isLowerCase(arr[i]))
{
count++;
}
}
*/
System.out.println(count);
}
}

0 comments on commit 99c810b

Please sign in to comment.